Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 576985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:06:18+00:00 2026-05-13T14:06:18+00:00

i did an application which has imageview to capture image from camera and a

  • 0

i did an application which has imageview to capture image from camera and a button where button is clicked pickerView will appear by actionsheet and will choose type of image(jpg, png, bmp..), once select from picker, button title will change according to the pickerView result,

then i try to convert this to UITableView, which has 2 section ( 1 for image and 1 for select the type of the image,

now i’m having problem where i try to imageView into the cell but image was overlapping other cell, and once image capture from camera that imageView not updated but once scroll the table than only updated,

another problem is, once select 2nd section i able to call the pickerView to choose the image type as previously, but once select from pickerView i don’t how to updated the cell.text

below is my code, can anyone help here or improve it,

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1; 
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    switch (section) {
        case 0:
            return NSLocalizedString(@"Image", @"");
            break;
        case 1:
            return NSLocalizedString(@"Image type", @"");
            break;
        default:
            break;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease];
    }

    switch (indexPath.section) {
        case 0:
        {
            UIImageView *abc = [[UIImageView alloc] initWithFrame:CGRectMake(5,5,100,100)];
            abc.image = imageView.image;
            [cell addSubview:abc];
        }
            break;
        case 1:
            cell.textLabel.text = @"- Click here -";
            break;
        default:
            break;
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"Cell"] autorelease];
    }

    if(indexPath.section == 0) {
        NSLog(@"selected %d",indexPath.section);
    }
    if(indexPath.section == 1) {
        NSLog(@"selected %d",indexPath.section);
        [self chooseType];
    }
}

- (void)chooseType{
    actionSheet = [[UIActionSheet alloc] initWithTitle:@""
                                              delegate:self
                                     cancelButtonTitle:nil
                                destructiveButtonTitle:nil
                                     otherButtonTitles:nil];

    NSArray *typeObject = [NSArray arrayWithObjects:@".jpg",@".png",@".bmp",nil];

    self.pickerData = typeObject;

    pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 44.0, 0.0, 0.0)];
    pickerView.delegate = self;
    pickerView.showsSelectionIndicator = YES;

    pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    pickerDateToolbar.barStyle = UIBarStyleBlackOpaque;
    [pickerDateToolbar sizeToFit];

    NSMutableArray *barItems = [[NSMutableArray alloc] init];

    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    [barItems addObject:flexSpace];
    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(TypeDonePick)];
    [barItems addObject:doneBtn];

    [pickerDateToolbar setItems:barItems animated:YES];

    [actionSheet addSubview:pickerDateToolbar];
    [actionSheet addSubview:pickerView];
    [actionSheet showInView:self.view];
    [actionSheet setBounds:CGRectMake(0,0,320, 464)];
    [pickerView release];
    [actionSheet release];  
}


- (void)TypeDonePick
{
    NSInteger row = [pickerView selectedRowInComponent:0];
    titleCause.textColor = [UIColor blackColor];
    titleCause.text = [pickerData objectAtIndex:row];
    NSLog(@" %@ ",titleCause.text);
    [actionSheet dismissWithClickedButtonIndex:0 animated:YES];
}

is it possible to change cell test from outside range UITable function

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:06:19+00:00Added an answer on May 13, 2026 at 2:06 pm

    Your problem is that the table doesn’t know it needs to update the cells already visible. for a quick solution just add [tableView reloadData] after the user picks the image/image type, this will cause the table to recreate the cells and get the updated data from them.

    If you want to update cells individually you can use [tableView cellForRowAtIndexPath:] to get the cell you want to update. e.g.

        UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
        cell.textLabel.text = @"updated text";
        // You might need to call the following function though I'm not sure
        // [cell.textLabel setNeedsDisplay];
    

    If you want to update the image I suggest you add a tag to the imageView in the cell and then you’ll be able to change it as follows:

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
    UIImageView *imageView = [cell viewWithTag:kImageViewTag];
    imageView.image = updatedImage;
    // Again you might need to tell the image to refresh it self
    //[imageView setNeedsDisplay];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.