Search Results

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

Page 9/27 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How to avoid truncation of text with UITableViewCellStyleValue2

    - by Regan
    I use this code to make my UITableViewCells cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease]; If you're unfamiliar with UITableViewCellStyleValue2, the main text is shown, and then the detail text is shown after it, generally in a different color. However, when I do this, my main text is truncated, if it is longer than a short word. I want to force it to not truncate the main text and show the entire main text, and then the detail text after it. How can I do that?

    Read the article

  • How do get the view that is the tapped detail-disclosure-button.

    - by Roberta
    The cell in this iPhone TableView definitely has a Detail-Disclosure-Button. When I tap it... shouldn't this code give me access to the button? Instead detailButton is always just null. - (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { UITableViewCell *aCell = [tableView cellForRowAtIndexPath:indexPath]; UIButton *detailButton = (UIButton *)[aCell accessoryView]; }

    Read the article

  • TableView Background image going over cell textLabel

    - by Alex Trott
    Currently my tableview looks like this: as you can see, cell.textLabel and cell.detailTextLable both load this background, and i can't work out how to get them to stop loading the background, and for it only to be the backing on the cell. Here's my current code to change the cell: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { [cell setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"tableCell.png"]]]; } How can i get round this problem? Thanks in advance.

    Read the article

  • Custom UITableviewcell shows "fatal error: Can't unwrap Optional.None" issue in swift

    - by user1656286
    I need to load a custom cell in a UITableView. I created a custom subclass of UITableViewCell named "CustomTableViewCell". I have added a UITabelViewCell to the tableview (using drag and drop) as shown in figure. Then in file inspector I set the class of that UITabelViewCell to be "CustomTableViewCell". Here is my code: class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource { @IBOutlet var tableView : UITableView var items = String[]() override func viewDidLoad() { super.viewDidLoad() items = ["Hi","Hello","How"] self.tableView.registerClass(CustomTableViewCell.self, forCellReuseIdentifier: "CusTomCell") // Do any additional setup after loading the view, typically from a nib. } func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int{ return items.count } func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!{ var cell:CustomTableViewCell = self.tableView.dequeueReusableCellWithIdentifier("CusTomCell") as CustomTableViewCell cell.labelTitle.text = items[indexPath.row] return cell; } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } When I run my code, I get the following error: "fatal error: Can't unwrap Optional.None" as seen in the image.

    Read the article

  • Problem in displaying custom UITableViewCell

    - by Vin
    Hi All, I have a tableview displaying data using a custom UITableViewCell(say cell1). On touch of a row, I change the custom cell to another custom UITableViewCell(say cell2). Also I increase the size of row of the selected cell to accomodate, more items of cell2. My problem is that the approach works fine when the number of rows in table view is less. When the number of rows increses, the rows expand on touching, but the data displayed is same as that of cell1. Cell2 doesn't seem to be loaded at all. Looking forward for a reply soon....Thanks in advance.

    Read the article

  • Storing unique ID in UITableViewCell

    - by culov
    I have a table where there will often be two cells with the same title. I'm zooming in on a map whenever a cell in the table is clicked, so using the title as a unique identifier is out of the question. I already have a unique identifier, but I need to find a way to store it in a UITableViewCell object. I have been considering two options, both of which are poor, IMO. 1) store the unique ID as the text inside the text of the detailTextLabel property. 2) build a custom UITableViewCell class. I'm new to objective C, and I would essentially like to know if theres a third option that isnt as inefficient as #1, but not as involved as #2. Thanks

    Read the article

  • UITableViewCell get nil

    - by MTA
    I create a UITableView with custom UITableViewCell,this is how i create the cell in cellForRowAtIndexPath: static NSString *CellIdentifier = @"SongsCell"; SongsCell *cell = (SongsCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil){ UIViewController *vc = [[[UIViewController alloc] initWithNibName:@"SongsCell" bundle:nil] autorelease]; cell = (SongsCell *) vc.view; } now i want to get all cells in the table info (parameter from cell) when a button pressed: for (int i = 0; i < [songTable numberOfRowsInSection:0]; i++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0]; UITableViewCell *cell = [songTable cellForRowAtIndexPath:indexPath]; } Now i have a problem that this loop give me for cell a nil for all the cell that currently not seen in the table.

    Read the article

  • "Warning reaching end of non-void fuction" with Multiple Sections that pull in multiple CustomCells

    - by Newbyman
    I'm getting "Reaching end of non-void function" warning, but don't have anything else to return for the compiler. How do I get around the warning?? I'm using customCells to display a table with 3 Sections. Each CustomCell is different, linked with another viewcontroller's tableview within the App, and is getting its data from its individual model. Everything works great in the Simulator and Devices, but I would like to get rid of the warning that I have. It is the only one I have, and it is pending me from uploading to App Store!! Within the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {, I have used 3 separate If() statements-(i.e.==0,==1,==2) to control which customCells are displayed within each section throughout the tableview's cells. Each of the customCells were created in IB, pull there data from different models, and are used with other ViewController tableViews. At the end of the function, I don't have a "cell" or anything else to return, because I already specified which CustomCell to return within each of the If() statements. Because each of the CustomCells are referenced through the AppDelegate, I can not set up an empty cell at the start of the function and just set the empty cell equal to the desired CustomCell within each of the If() statements, as you can for text, labels, etc... My question is not a matter of fixing code within the If() statements, unless it is required. My Questions is in "How to remove the warning for reaching end of non-void function-(cellForRowAtIndexPath:) when I have already returned a value for every possible case: if(section == 0); if(section == 1); and if(section == 2). *Code-Reference: The actual file names were knocked down for simplicity, (section 0 refers to M's, section 1 refers to D's, and section 2 refers to B's). Here is a sample Layout of the code: //CELL FOR ROW AT INDEX PATH: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //Reference to the AppDelegate: MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; //Section 0: if(indexPath.section == 0) { static NSString *CustomMCellIdentifier = @"CustomMCellIdentifier"; MCustomCell *mCell = (MCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomMCellIdentifier]; if (mCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[MCustomCell class]]) mCell = (MCustomCell *)oneObject; } //Grab the Data for this item: M *mM = [appDelegate.mms objectAtIndex:indexPath.row]; //Set the Cell [mCell setM:mM]; mCell.selectionStyle =UITableViewCellSelectionStyleNone; mCell.root = tableView; return mCell; } //Section 1: if(indexPath.section == 1) { static NSString *CustomDCellIdentifier = @"CustomDCellIdentifier"; DCustomCell *dCell = (DCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomDaddyCellIdentifier]; if (dCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[DCustomCell class]]) dCell = (DCustomCell *)oneObject; } //Grab the Data for this item: D *dD = [appDelegate.dds objectAtIndex:indexPath.row]; //Set the Cell [dCell setD:dD]; //Turns the Cell's SelectionStyle Blue Highlighting off, but still permits the code to run! dCell.selectionStyle =UITableViewCellSelectionStyleNone; dCell.root = tableView; return dCell; } //Section 2: if(indexPath.section == 2) { static NSString *CustomBCellIdentifier = @"CustomBCellIdentifier"; BCustomCell *bCell = (BCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomBCellIdentifier]; if (bCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"BCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[BCustomCell class]]) bCell = (BCustomCell *)oneObject; } //Grab the Data for this item: B *bB = [appDelegate.bbs objectAtIndex:indexPath.row]; //Set the Cell [bCell setB:bB]; bCell.selectionStyle =UITableViewCellSelectionStyleNone; bCell.root = tableView; return bCell; } //** Getting Warning "Control reaches end of non-void function" //Not sure what else to "return ???" all CustomCells were specified within the If() statements above for their corresponding IndexPath.Sections. } Any Suggestions ??

    Read the article

  • Why is -[UISwitch superlayer] being called?

    - by Jonathan Sterling
    I've got sort of a crazy thing going on where I have an NSProxy subclass standing in for a UISwitch. Messages sent to the proxy are forwarded to the switch. Please don't comment on whether or not this is a good design, because in context, it makes sense as an incredibly cool thing. The dealio is that when I try to add this object as an accessory view to a UITableViewCell, I get the following crash: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISwitch superlayer]: unrecognized selector sent to instance 0x5889740' Yes, I could just set the proxy's target as the accessory view, but then I would have to keep track of the proxy so that I could release it at the right time. So, what I really want is to be able to have the proxy retained by the table cell, and released when it is removed from the view just like a normal accessory view. So, why is -[UISwitch superlayer] (a method which does not exist) being called, and how do I save the world?

    Read the article

  • UIButtonTypeRoundedRect as an accessoryView

    - by phunehehe
    Hello, I have a table view and I want to put a label on the right of each cell, so in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath I'm having some code like this UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.titleLabel.text = @"title"; cell.accessoryView = button; However, the button is not displaying at all. Anyone know why? I am sure that the declaration is correct, because if I replace the button declaration with UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; then the button appears, which make me think that the rounded rectangle should also appear.

    Read the article

  • MKMapView within UITableView

    - by john-london
    I have a MKMapView within a UITableviewCell and I want to be able to disable scrolling of the table view when the user starts to drag within the map view. My plan had been to override the MKMapView touchesBegan/Moved etc methods and if they were called to then disable scrolling in the parent view. Scrolling in the parent view would be enabled again only when the touches in the MKMapView ended or were cancelled. My problem is that the touchesBegan/Moved methods inside MKMapView are not called - the problem is also discussed here: stackoverflow discussion. My table view is within a tab control, so I don't think I can extend UIWindow the way they describe, as there are several views that could be within the window, depending on which tab is active. How can I access the MKMapView touch events please?

    Read the article

  • How to add a view on cell.contentview of uitableview iphone sdk

    - by neha
    Hi all, In my application I'm creating a .xib of a class and loading that .xib on cells of uitableview of another class. I want to add this .xib to cell.contentView and not cell. How shall I do that? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellIdentifier = @"testTableCell"; testTableCell * cell = (testTableCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"testTableCell" owner:self options:nil]; cell = tCell; } return cell; } testTableCell is my another class in which I have two labels and two buttons, of which I have created a .xib and loading it to tableview's cell as above. tCell is an object of class testTableCell. Thanks in advance.

    Read the article

  • Show blank UITableViewCells in custom UITableView

    - by Typeoneerror
    I am trying to customize a UITableView. So far, it looks good. But when I use a custom UITableViewCell sub-class, I do not get the blank table cells when there's only 3 cells: Using the default TableView style I can get the repeating blank rows to fill the view (for example, the mail application has this). I tried to set a backgroundColor pattern on the UITableView to the same tile background: UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"score-cell-bg.png"]]; moneyTableView.backgroundColor = color; ...but the tile starts a bit before the TableView's top, so the tile is off once the actual cell's are done displaying: How can I customize my tableview but still keep the blank rows if there's less rows than fill a page?

    Read the article

  • How can I set a highlighted image on a table view cell?

    - by nevan
    I've followed the code in Apple's AdvancedTableViewCells and built a table view with a background image for cells. Now I want to change it so that instead of the blue highlight colour, it shows a darker version of my image. What are the steps I need to follow to do this? I'm using a UITableViewCell subclass with a custom NIB. My background image is implemented as the cell.backgroundView. The steps I've take so far are: Change the selectionStyle of the cell to "None" Set the Highlight colour on my UILabel subviews to a light colour Create a darker version of my background as a separate image Override setSelected: animated: I'm wondering about the next steps.

    Read the article

  • Refreshing a UITableView

    - by MihaiD
    I have a UITableView subclass and a UITableViewCell sublass that I'm using for cells. I'm bulding all my cells in advance and store them in an array from where I use them in cellForRowAtIndexPath. Aside from this I have a thread that loads some images in each cell, in the background. The problem is that the cells don't get refreshed as fast as the images are loaded. For example, if I don't scroll my table view, the first cells only get refreshed when all cells have been modified and the thread has exited. Any ideas on how I can effectively refresh my tableview/cell?

    Read the article

  • Problem with Scrolling UITableView

    - by HiGuy Smith
    Hello, I have a navigation-based application that has a scrolling UITableView filled with the contents of a directory. Somehow, when I try to scroll a new cell into view, the application crashes. I have determined that it goes down to these lines of code in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {: NSString *cellText = [contentArray objectAtIndex:indexPath.row]; cell.textLabel.text = cellText; Now why this is crashing, I don't know. contentArray is a NSArray with the table data. If you need a bit more code to tell: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [contentArray count]; } Please help me with this problem, HiGuy

    Read the article

  • Caching issues with TDBadgedCell

    - by Wolfgang Schreurs
    This post is closely related to my previous post: http://stackoverflow.com/questions/2201256/tdbadgedcell-keeps-caching-the-badgenumber The "badge" from TDBadgedCell keeps caching the numbers. A very simple example is shown here: - (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; TDBadgedCell *cell = (TDBadgedCell *)[_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; } [cell setBadgeColor:[UIColor blackColor]]; [cell setBadgeNumber:[indexPath row]]; [[cell textLabel] setText:[NSString stringWithFormat:%@"%d", [indexPath row]]]; return cell; } Anyone has any clue why this happens? The textLabel and detailTextLabel don't cache the data. Any additonal info would be welcome as well, as I seem to have a lot of issues with the caching of graphics in UITableViewCells. Any best practices or other useful information would be most welcome.

    Read the article

  • Attributed strings in UITableViewCells without WebView?

    - by arnekolja
    Hello, does anyone know if there's a way in with 3.0+ to display attributed strings within a UITableViewCell without using a UIWebView for that? I need to display a string with linked, tappable substrings as the typical detailTextLabel. I wouldn't mind exchanging this UILabel against another type of view, but I think a UIWebView could be just too slow when rendering a table with hundrets of cells. Or does someone have opposite experiences here? So my question is: what's the best way to achieve mixed strings in a very large table without a great performance hit? I searched for this almost a whole day now, but I can only find old posts mentioning that there's no attributed string on the iPhone (outdated, as this was pre-3.0) and/or saying that they use a UIWebView for that. But really, I don't think this would perform very well on large tables, would it? Many, many thanks in advance Arne

    Read the article

  • Custom cell and Delete/Move indicators

    - by Kamchatka
    Hello, I have a custom UITableViewCell. However, when I got in edit mode, I don't have any Delete and Move indicators appearing. The custom cell draws itself in the contentView. In layoutSubviews, I make sure there is space on the left and one the right of the contentView so that the controls can appear (if this was the problem). - (void)layoutSubviews { self.contentView.frame = CGRectMake(50, 0, self.frame.size.width - 100, sub.thumbnail.size.height + 20); } In the UITableViewController, I return YES in: - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { How could I solve this lack of interactivity. Is there something specific for custom cells? Thanks!

    Read the article

  • reloadData not working - suspect cell's reuseIdentifier

    - by retailevolved
    I have a view controller that gets presented modally and changes some data that effects the data in a uitableview in the modal's parent view controller (a table view). I call the tableview's reloadData method when the parent view reappears. I have confirmed that this code gets hit with a break point. My trouble is, reloadData isn't working. Here's the kicker - if I don't use reuseIdentifiers in the - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath method, the data reloads correctly. It looks like the reuseIdentifier is to blame. I really want to continue to use the reuseIdentifier for my cells - how do I make this work?

    Read the article

  • How can we show the preview image of the video in table view cell ?

    - by srikanth rongali
    I have a table view and if we touch a cell a video plays. I need to show the preview image of the video in the UITableViewCell. I have kept some dummy image in the cell at image place and remaining space ion cell is with some labels and buttons. I need the image preview of the video with play symbol on it. How can I make this ? Should I use any photoshop type of things or any programable things. I do not know photoshop. Thank You.

    Read the article

  • Settings cell selected background view removes backgroundview

    - by Chris
    I'm trying to set up custom UITableViewCells. I can set the backgroundView no problem, but if I set selectedBackgroundView, the cell's background becomes white and only the selected background is seen: - (void) createCell: (UITableViewCell*)cell onRow: (NSUInteger)row { UIImageView* bgImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_background_red.png"]]; cell.backgroundView = bgImage; cell.selectedBackgroundView = bgImage; cell.textLabel.hidden = YES; UILabel* titleLabel = [[UILabel alloc] initWithFrame: CGRectMake(20, CGRectGetHeight(cell.frame) / 2, 200, 50)]; titleLabel.text = [[self.ruleList objectAtIndex: row] objectForKey: TitleKey]; titleLabel.backgroundColor = [UIColor clearColor]; [cell.contentView addSubview: titleLabel]; }

    Read the article

  • Wrong cells values of UITableView per section

    - by androniennn
    I have a UITableView that has a different rows count in every section. I made that code to try achieving a correct result: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier= @"channel"; ChannelsCell *cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(!cell) { cell =[[ChannelsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSInteger rowsCountSection = [[arrayofChannelsCount objectAtIndex:indexPath.section] intValue];// this variable has the number of rows of every section NSUInteger pos = indexPath.section*count+ indexPath.row; cell.channelName.text=[arrayofChannelName objectAtIndex:pos]; return cell; } I'm pretty sure that's a mathematic problem. Thank you for helping.

    Read the article

  • Using a CALayer in UITableViewCell

    - by Brian
    On each cell of my table view I want to have a bar that the user can slide out from the right. On the bar I plan to have icons. So, to do this I subclassed UITableViewCell. On the cell I have implemented drawRect and in there I have already drawn a gradient and background color on the cell. From there, I can create a CALayer, give it a frame & background color, and add it as a sub layer to the Views subLayers array. I can do all that and it will display my layer on each UITableViewCell. I have added touch events to the cell so I can detect when the user touches the cell and for testing I have made it so when the user swipes, my CALayer gets wider. But the issue is, when the UITableView scrolls and reuses a cell whose CALayer has been widened, it doesn't recreate the CALayer. I have tried [myLayer setNeedsDisplay] and used the drawLayer:inContext method of its delegate and it doesn't get called. I have also tried telling call setNeedsDisplay on the cell in my UITableViewController hoping that that will cause a redraw, but it doesn't work. I'm not sure what I'm missing. I am new to CoreGraphics & CoreAnimation. I have read through the CoreAnimation Developers Guide, but I'm assuming I missing something. Any help would be great.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >