Search Results

Search found 655 results on 27 pages for 'uitableviewcell'.

Page 4/27 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How To Load Images into Custom UITableViewCell?

    - by Clifton Burt
    This problem is simple, but crucial and urgent. Here's what needs to be done: load 66px x 66px images into the table cells in the MainViewController table. each TableCell has a unique image. But how? Would we use cell.image?... cell.image = [UIImage imageNamed:@"image.png"]; If so, where? Is an if/else statement required? Help? Here's the project code, hosted on Google Code, for easy and quick reference... http://www.google.com/codesearch/p?hl=en#Fcn2OtVUXnY/trunk/apple-sample-code/NavBar/NavBar/MyCustomCell.m&q=MyCustomCell%20lang:objectivec To load each cell's labels, MainViewController uses an NSDictionary and NSLocalizedString like so... //cell one menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"PageOneTitle", @""), kTitleKey, NSLocalizedString(@"PageOneExplain", @""), kExplainKey, nil]]; //cell two menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"PageOneTitle", @""), kTitleKey, NSLocalizedString(@"PageOneExplain", @""), kExplainKey, nil]]; ... // this is where MainViewController loads the cell content - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MyCustomCell *cell = (MyCustomCell*)[tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; if (cell == nil) { cell = [[[MyCustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease]; } ... // MyCustomCell.m adds the subviews - (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier { self = [super initWithFrame:aRect reuseIdentifier:identifier]; if (self) { // you can do this here specifically or at the table level for all cells self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // Create label views to contain the various pieces of text that make up the cell. // Add these as subviews. nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; // layoutSubViews will decide the final frame nameLabel.backgroundColor = [UIColor clearColor]; nameLabel.opaque = NO; nameLabel.textColor = [UIColor blackColor]; nameLabel.highlightedTextColor = [UIColor whiteColor]; nameLabel.font = [UIFont boldSystemFontOfSize:18]; [self.contentView addSubview:nameLabel]; explainLabel = [[UILabel alloc] initWithFrame:CGRectZero]; // layoutSubViews will decide the final frame explainLabel.backgroundColor = [UIColor clearColor]; explainLabel.opaque = NO; explainLabel.textColor = [UIColor grayColor]; explainLabel.highlightedTextColor = [UIColor whiteColor]; explainLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:explainLabel]; //added to mark where the thumbnail image should go imageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 66, 66)]; [self.contentView addSubview:imageView]; } return self; } HELP?

    Read the article

  • UITableViewCell no userInteraction but on cell.accessoryView

    - by Simon
    hello genius and nerds I have a TableViewCell with a UISwitch in accessoryView. I don't want that blue background if someone selected it. There fore i used cell.userInteractionEnabled = NO; but then the whole cell isnt accessable so i tried that cell.userInteractionEnabled = NO; cell.accessoryView.userInteractionEnabled = YES; i think this wont work because cell is the parent of the accessoryView. but how can i manage this issue ? A hint in the right direction would be great. Simon Here is the complete cellForRowAtIndexPath method: cell.textLabel.text = @"dasda"; cell.userInteractionEnabled = NO; cell.accessoryType = UITableViewCellAccessoryNone; UISwitch *mySwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease]; mySwitch.tag = row; [cell addSubview:mySwitch]; cell.accessoryView = mySwitch; cell.accessoryView.userInteractionEnabled = YES; [(UISwitch *)cell.accessoryView setOn: YES]; [(UISwitch *)cell.accessoryView addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventValueChanged]; return cell;

    Read the article

  • Change UITableViewCell Height on Orientation Change

    - by Peter Zich
    I have a UITableView with cells containing variable-height UILabels. I am able to calculate the minimum height the label needs to be using sizeWithFont:constrainedToSize:lineBreakMode:, which works fine when the table view is first loaded. When I rotate the table view the cells become wider (meaning there are fewer lines required to display the content). Is there any way I can have the height of the cells redetermined by the UITableView during the orientation change animation or immediately before or after? Thank you.

    Read the article

  • UITableViewCell imageView.contentMode doesn't work in 3.0

    - by JustinXXVII
    In UITableViewCellStyleDefault, setting the contentMode on the imageView has no result. If I change my build SDK to version 3.1, everything again works. I don't get any warnings or errors when compiling on 3.0 but this code: cell.imageView.contentMode = UIViewContentModeScaleAspectFit; cell.imageView.image = [UIImage imageNamed:[[NSString stringWithFormat:@"%@head.jpg",[gametype objectAtIndex:indexPath.row]]lowercaseString]]; seems to default to the UIViewContentModeCenter, so all of my pictures exceed the cell boundaries and encroach on neighboring cells. Let me reiterate that if I change my target to 3.1 everything works correctly and all pictures are scaled accordingly to fit in the default imageView Is this a known bug?

    Read the article

  • Trying to force redraw of UITableViewCell

    - by Suresh
    I found this post on Beveled UITableViewCells from http://news.selectstartstudios.com/beveled-uitableviewcells/. I'm using the technique to reduce the width of the cells, and for the most part it works great. However, I have a small problem. Sometimes the cells are not redrawn properly. For example, even though a cell is supposed to be a "middle" cell, it is drawn as a "top" cell: yfrog.com/f1screenshot20100424at100 How can I fix this? I have tried forcing the cell to redraw via [cell setNeedsDisplay], [cell setNeedsLayout], [tableView reloadRowAtIndexPath:withAnimation:], [cell drawrect:], and [tableView drawRect:atIndexPath]. I am out of ideas. Thanks again!

    Read the article

  • iPhone - Is it ok to override UITableViewCell setSelected:animated

    - by Brian
    I am drawing custom UITableViewCells. My cells are opaque and are completely drawn in the drawRect of the cell to help with performance. I want to handle the look of a selected cell myself. If I don't, then the contents of my cell is covered up by the selectedBackgroundView that is added. Is it common or acceptable to override the setSelected:animated method of my cell so this is done properly. I guess if I did that, then I would not call the super's setSelected method since I would be handling how the cell will show that its selected. I would also have to set the selected property of the cell. Any help would be great. Thanks.

    Read the article

  • Custom UITableViewCell not properly hiding views

    - by adamweeks
    I am using apple's custom table view cell code and modifying the drawRect code within the cell's view to look like I want it to. I've changed it to have some UILabels as well as a UIProgressView. If the data the cell is being built on doesn't have a certain field, I want the UIProgressView to be hidden. This works for a little while, but when a cell gets requeued, the progress view will start displaying again, even when I set it to hidden = YES. I've tried just not creating the ProgressView unless the data was there and that didn't work either. I thought the answer was in the [self setNeedsDisplay] but that doesn't seem to help. Here is the code for the progressview from drawRect that continues to be displayed: UIProgressView *c1Progress = [[UIProgressView alloc]initWithFrame:CGRectMake(20.0, 70.0, 280.0, 12.0)]; float iProgress = (value / target); c1Progress.progress = iProgress; if (!dataExists) { c1Progress.hidden = YES; } [self addSubview:criteria1Progress]; [c1Progress release];

    Read the article

  • UITableViewCell with selectable/copyable text that also detects URLs on the iPhone

    - by Jasarien
    Hi guys, I have a problem. Part of my app requires text to be shown in a table. The text needs to be selectable/copyable (but not editable) and any URLs within the text need to be highlighted and and when tapped allow me to take that URL and open my embedded browser. I have seen a couple of solutions that solve one of either of these problems, but not both. Solution 1: Icon Factory's IFTweetLabel The first solution I tried was to use the IFTweetLabel class made possible by Icon Factory and used in Twitterrific. While this solution allows for links (or anything you can find with a regex) to be detected to be handled on a case by case basis, it doesn't allow for selecting and copying. There is also an issue where if a URL is long enough to be wrapped, the button that the class overlays above the URL to make it interactive cannot wrap and draws off screen, looking very odd. Solution 2: Use IFTweetLabel and handle copy manually The second thing I tried was to keep IFTweetLabel in place to handle the links, but to implement the copying using a long-tap gesture, like how the SMS app handles it. This was just about working, but it doesn't allow for arbitrary selection of text, the whole text is copied, or none is copied at all... Pretty black and white. Solution 3: UITextView My third attempt was to add a UITextView as a subview of the table cell. The only thing that this doesn't solve is the fact that detected URLs cannot be handled by me. The text view uses UIApplication's openURL: method which quits my app and launched Safari. Also, as the table view can get quite large, the number of UITextViews added as subviews cause a noticeable performance drag on scrolling throughout the table, especially on iPhone 3G era devices (because of the creation, layout, compositing whenever a cell is scrolled on screen, etc). So my question to all you knowledgeable folk out there is: What can I do? Would a UIWebView be the best option? Aside from a performance drag, I think a webview would solve all the above issues, and if I remember correctly, back in the 2.0 days, the Apple documentation actually recommended web views where text formatting / hyperlinks were required. Can anyone think of a way to achieve this without a performance drag? Many thanks in advance to everyone who can help.

    Read the article

  • UIActivityIndicator on UITableViewCell not displaying while calling a webService

    - by Yoyi Cheika
    Hi coders, I guess my problem is very simple to solve but I haven been able to do so. Here is my problem: I have a custom table view cell that contains a UIActivityIndicator. When a cell is selected I push another view but this second view makes a call to a web service to bring data. Here is my code // Override to support row selection in the table view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here -- for example, create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController animated:YES]; // [anotherViewController release]; Models *models = [[Models alloc] initWithNibName:@"Models" bundle:nil]; models.make = ((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).make.text; models.year = (int)[self.yearLabel.text doubleValue]; models.logo = [makeLogosName objectAtIndex:indexPath.row]; [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator startAnimating]; [self.navigationController pushViewController:models animated:YES]; [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating]; [models release]; } Where MakeCell is my custom cell. If I comment this line [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating]; then the indicator appears as expected when going back to the previous view. I feel like the indicator is not being visually updated until the didSelectRowAtIndexPath returns. Does is works ascyncronically. What can be my problem here. Thank you very much Cheika

    Read the article

  • UITableViewCell indentation not in edit mode.

    - by Eric P.
    When you enter editing mode on a grouped-style UITableView, the cells indent to show the editing control (if you aren't sure what I mean, see this picture (editing mode) http://i.imgur.com/GJXvL.png and this (non-editing mode) http://i.imgur.com/ahKYS.png). I am trying to manually indent a cell when the tableView is not in editing mode. I tried the indentationLevel property, but that just moves the text further to the right inside the cell and doesn't actually change the cell. Any ideas?

    Read the article

  • Set tag and hidden for objects on custom UITableViewCell

    - by Rob
    I am re-using Apple's AdvancedTableViewCells example to create a custom, fast-scrolling tableview. Specifically, I am using their CompositeSubviewBasedApplicationCell method which draws the content on the tableviewcell with drawRect Everything works, but how do you hide a label or set the tag for a label or image using their method? Doing it this way is pretty new to me (without IB), so I apologize ahead of time if it's something easy. The code that sets the cell content is: - (void)drawRect:(CGRect)rect { [_cell.animalIcon drawAtPoint:CGPointMake(5.0, 5.0)]; [_cell.animalName drawAtPoint:CGPointMake(93.0, 25.0)]; _highlighted ? [[UIColor whiteColor] set] : [[UIColor colorWithWhite:0.23 alpha:1.0] set]; [_cell.animalDescription drawAtPoint:CGPointMake(100.0, 54.0) withFont:[UIFont boldSystemFontOfSize:13.0]]; [_cell.animalNameString drawAtPoint:CGPointMake(93.0, 5.0) withFont:[UIFont boldSystemFontOfSize:13.0]]; }

    Read the article

  • UITableViewCell color issues with custom table view background

    - by Macatomy
    I have a UITableView with a custom background image set like this: self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mybg.png"]]; The background appears fine, but my UITableViewCells (default cells, not custom) have some sort of weird tint to them, and the UILabel containing the "New Project" text also seems to have some sort of background behind it. How can I remove this? I've already tried: cell.backgroundColor = [UIColor clearColor]; cell.textLabel.backgroundColor = [UIColor clearColor]; Thanks

    Read the article

  • UITextView in UITableViewCell scrolling problems.

    - by jrtc27
    Ok. I have made a custom cell for my table, and it contains a text view. When I have multiple lines in the text view, I can scroll up and down, but in doing this the table also scrolls. How can I stop this behaviour? If anyone needs parts of my code or further details, please just ask. I am more than willing. Thank you for your help

    Read the article

  • textLabel.backgroundColor on UITableViewCell does not work

    - by Tom
    Hi! I'm trying to set the label backgroundColor of my UITableViewCells and it does absolutely nothing at all. I wonder if there's another way of doing this, so I'm asking! I tried this: cell.textLabel.backgroundColor = [UIColor redColor]; cell.backgroundColor = [UIColor redColor]; And it doesn't work, anything else? Thanks!

    Read the article

  • Left with extra UITableViewCell after re-ordering

    - by Mark F
    After going into Edit mode, moving a cell, and leaving edit mode, i am left with one extra cell sitting on top of its duplicate cell while still in edit mode. The problem has to be somewhere in here: - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath { NSMutableArray *array = [[fetchedResultsController fetchedObjects] mutableCopy]; id objectToMove = [[array objectAtIndex:sourceIndexPath.row] retain]; [array removeObjectAtIndex:sourceIndexPath.row]; [array insertObject:objectToMove atIndex:destinationIndexPath.row]; [objectToMove release]; for (int i=0; i<[array count]; i++) { [(NSManagedObject *)[array objectAtIndex:i] setValue:[NSNumber numberWithInt:i] forKey:@"userOrder"]; } [array release]; } Any guidance greatly appreciated!

    Read the article

  • Iphone UITableViewCell selection background

    - by user360297
    Hi, I'm developing custom tableViewCell for iphone, I used interface builder to design it and loaded in from code. It use custom background to show Cell Selection. It work ok expect form one small issue, there is a small rectangular area in left side dosen't show the custom image, but show default selection ( bule color ) in that area. Please take look at the image @ this link http://warunadesilva.com/fih/Untitled.png I selection image's with is 320px. Could anyone suggest possible solution for this problem, Thank you in advance. Waruna

    Read the article

  • Fade animation UITableViewCell

    - by Tomas
    Hi everyone, I have a UITableViewController that populates a UITableView with some data that I pull off the net. The data for each cell consists also of an image used as background, which I'm downloading in a separated NSOperation added to a NSOperationQueue with a MaxConcurrentOperationCount set to 4. As long as the image is not downloaded I'm showing a generic placeholder which I would like to replace (fading out/fading in) with the downloaded image once it's being successfully downloaded. I'm using the following code placed inside the cellForRowAtIndexPath of the UITableViewController. [UIView beginAnimations:@"fade" context:nil]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:3.0]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; cell.placeholderUIImage.alpha = 0.0; cell.backgroundUIImage.alpha = 1.0; [UIView commitAnimations]; This is unfortunately just working randomly for a couple of rows, since for the most the background image is set instantly, as if the animation started on one cell would have been "overwritten" by the next call of beginAnimations.

    Read the article

  • iphone how to customize UITableViewCell cell.textlabel and cell.detailtextlabel programmatically

    - by Prerak
    Hi! In my iPhone App In table view cell I want to dispaly one main title and 5 subtitlessubtitles suppose item1 as main title and item2 , item3 , item4 , item5 and item6 as subtitles, for that i have saperate two arrays for passing the values in table view cell one for cell.textLabel.text= second for cell.detailTextLabel.text now I want the flexibility to make item2 as maintitle and want to add item1 to subtitle How can I set title and subtitle programmatically from single array? and any of them as Please Help and Suggest, Thank You.

    Read the article

  • UITableViewCell and strange behaviour in grouped UITableView

    - by evangelion2100
    I'm working on a grouped UITableView, with 4 sections with one row per section, and have a strange behaviour with the cells. The cells are plain UITableViewCells, but the height of the cells are around 60 - 80 pixel. Now the tableview renders the cells correct with round corners, but when I select the cells, they appear blue and recangle. I don't know why the cells behave like this, because I have another grouped UITableView with custom cells and 88 pixel height and those cells work like they should. If I change the height to the default height of 44 pixel, the cells behave like the should. Does anyone know about this behaviour and what the cause is? Like I mentioned, I don't do any fancy stuff I use default UITableViewCells in a static, grouped UITableView with 4 sections with 1 row in each section. evangelion2100

    Read the article

  • Adding buttons dynamically to a uitableviewcell - iPhone app

    - by alan
    I have a verb conjugation app that displays verb translations in the first cell of a table. At present the translation list is just a string (comma-separated list) but I'd like to change it to have clickable buttons. I had a play around adding buttons to the cell view without too much success but my only experience with custom cells has been using specific positioning so I'm unsure as to how to achieve a dynamic list of buttons (varying widths) within a cell. Any help greatly appreciated. Cheers.

    Read the article

  • UITableView scrollable background , UITableViewCell transparency

    - by f0rz
    Hi! In my UITableView I have custom cells. My UITableView have a repeatable background myTableView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"backg.png"]]; I set my cells to have their background (clear); UIView *backView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; backView.backgroundColor = [UIColor clearColor]; cell.backgroundView = backView; This makes the cell have the same background as the TableView.. Problem is; That seems that every cell loads myTableView.backgroundColor once again. And the background are not being repeatble as it should. I want to have the cells totally with no background at all, instead they loads up myTableView.backgroundColor once again. Here is one example. Can anyone help me?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >