Search Results

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

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

  • Asynchronous Image loading in certain custom UITableViewCells

    - by Dan
    So, I'm sure that this issue has been brought up before, but I haven't quite seen a solution for my specific problem. What I'm doing is loading a group of custom UITableViewCell's that are drawn using Loren Brichter's solution, each cell has some content, an icon (representing the user) that is asynchronously loaded into it, and a few other things. Eventually, I'm hoping to add support for images. Not every cell has an image, so in the creation of the cell, it determines if an image is required to be loaded and drawn into the cell. My problem is that I don't know how I can do that while keeping the image loaded asynchronously - with not every cell having the need to load an image (like needed with the icon) I'm not sure how to keep it in order when an cell is thrown off screen and re-rendered when the user scrolls over it. Each cell draws it content from an NSArray containing a custom object called FeedItem. All I'm really looking for is some sort of solution or idea to help me because right now I am at a loss. Thanks guys, I will appreciate the help.

    Read the article

  • Adding a dynamic image to UITable View Cell

    - by Graeme
    Hi, I have a table in which I want a dynamic image to load in at the left-hand side. The table needs to use an IF statement to select the appropriate image from the "Resources" folder, and needs to be based upon [dog types]. The [dog types] is extracted from an RSS feed, and so the image in the table cell needs to match the each cell's [dog types] tag. Update: See code below for what I'm looking to do (only below it's for earthquakes, for me its pictures of dogs). I suspect I need to use - (UIImage *)imageForTypes:(NSString *)types { to do such a thing. Thanks. Updated code: This is for Apple's Earthquake sample but does exactly what I need to do. It matches images to the severity (2.0, 3.0, 4.0, 5.0 etc.) of every earthquake to the magnitude. - (UIImage *)imageForMagnitude:(CGFloat)magnitude { if (magnitude >= 5.0) { return [UIImage imageNamed:@"5.0.png"]; } if (magnitude >= 4.0) { return [UIImage imageNamed:@"4.0.png"]; } if (magnitude >= 3.0) { return [UIImage imageNamed:@"3.0.png"]; } if (magnitude >= 2.0) { return [UIImage imageNamed:@"2.0.png"]; } return nil; } and under - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath magnitudeImage.image = [self imageForMagnitude:earthquake.magnitude];

    Read the article

  • iPhone UITableView stutters with custom cells. How can I get it to scroll smoothly?

    - by Charles S.
    I'm using a UITableView to display custom cells created with Interface Builder. The table scrolling isn't very smooth (it "stutters") which leaves me to believe cells aren't being reused. Is there something wrong with this code? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"TwitterCell"; TwitterCell *cell = (TwitterCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil){ //new cell NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TwitterCell" owner:nil options:nil]; for(id currentObject in topLevelObjects) { if([currentObject isKindOfClass:[TwitterCell class]]) { cell = (TwitterCell *)currentObject; break; } } } if([self.tweets count] > 0) { cell.lblUser.text = [[self.tweets objectAtIndex:[indexPath row]] username]; cell.lblTime.text = [[self.tweets objectAtIndex:[indexPath row]] time]; [cell.txtText setText:[[self.tweets objectAtIndex:[indexPath row]] text]]; [[cell imgImage] setImage:[[self.tweets objectAtIndex:[indexPath row]] image]]; } else { cell.txtText.text = @"Loading..."; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }

    Read the article

  • How to change rowHeight of a TableViewCell depending on Stringlength

    - by Jens Koehler
    I have a table with different entries, each with different length. The height of each row should fit, so it can show the whole string. I use the following code: //... cellForRowAtIndexPath if (row == 0) { cell = [tableView dequeueReusableCellWithIdentifier:@"affCell"]; //if (!cell) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"affCell"]autorelease]; cell.accessoryType = UITableViewCellAccessoryNone; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.autoresizingMask = UIViewAutoresizingFlexibleHeight; affL = [[UILabel alloc] initWithFrame:CGRectZero]; affL.textAlignment = UITextAlignmentLeft; affL.autoresizingMask = UIViewAutoresizingFlexibleHeight; [cell.contentView addSubview:affL]; //} //declaration label affL.text = [fDictionary objectForKey:@"aff"]; affL.numberOfLines = 0; [affL sizeToFit]; affL.frame = CGRectMake(15.0, 10.0, 220.0, affL.frame.size.height); CGFloat affLH = affL.frame.size.height; [tableView setRowHeight:affLH+30]; I also use //... heightForRowAtIndexPath return affL.frame.size.height; How can I fix this problem?

    Read the article

  • How to get a UIScrollView embedded within a UITableCellView to scroll?

    - by Zan
    I have a scroll view containing several images embedded within a custom cell view, it sometimes scrolls horizontally if I keep holding the cell for a while. I tried a lot of things and it doesn't seem to work, please help? Here's part of the CustomCell : UITableViewCell code: -(void) layoutSubviews { CGRect scrollViewFrame = CGRectMake(0, 0, 320, 200); self.scrollView.frame = scrollViewFrame; self.scrollView.backgroundColor = [UIColor whiteColor]; self.scrollView.contentSize = CGSizeMake((320*3), 200); self.scrollView.scrollEnabled = YES; self.scrollView.clipsToBounds = YES; self.scrollView.pagingEnabled = YES; self.scrollView.showsHorizontalScrollIndicator = NO; self.scrollView.showsVerticalScrollIndicator = NO; self.scrollView.scrollsToTop = NO; self.scrollView.delegate = self; self.scrollView.userInteractionEnabled = YES; // add 3 images to subview here pageControl.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7]; pageControl.frame = CGRectMake(0, 170, 320, 30); pageControl.numberOfPages = 8;} I tested the code on a UIViewController and it works just fine, I'm guessing that this is caused by cell selection and I tried returning nil when the cell gets selected and that didn't work. I also tried passing touches to the scrollview and that didn't work either, please help?

    Read the article

  • custom cells uitableview - cannot display all the rows

    - by Matt Facer
    Hi guys, I'm creating a uitableview with custom cells which I created in Interface Builder. There are currently three cells (UITableViewCell). I have a UITableView which is on the view. The code I have is fairly standard, but I cannot work out how to actually SHOW the three custom cells. I am using the cellForRowAtIndexPath method. My aim is to get a grouped uitableview which shows like the following Item - Name Settings - alert - time So the above indented view should be my grouped uitableview. The problem is, I cannot get it to show using code. The uitableview will ALWAYS be this. I am trying to replicate the settings style screen... so I do not have any arrays to display the uitableview cells. How do I actually display my three cells? I have the following code - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) return 1; else return 2; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if(section == 0) return @"Item"; else return @"Settings"; } So all I need to know is how to actually display my custom cells inside the tableview! Thanks for any information. I've searched for AGES in google .. all the tutorials use arrays to display data!

    Read the article

  • UITableView with Custom Cell only loads one row of data at a time

    - by Anton
    For my table, I've created a custom cell that has two labels. I also have two arrays with data, that I use to respectively assign each label in the cell. My problem, is that when the table is viewed, only the first row has data, and the rest of the data "sorta" loads when I start scrolling down. By "sorta", only the first row will load at a time. The only time I get to see all the data, is when I scroll to the bottom, then scroll up again. I've used the cellForRowAtIndexPath method to load the data into my cell. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CustomCellIdentifier = @"CustomCellIdentifier"; CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[CustomCell class]]) cell = (CustomCell *)oneObject; } NSUInteger row = [indexPath row]; //I have two tables to fill up, hence the tag if statement if ([tableView tag] == 0) { cell.arriveTimeLabel.text = [homeBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [homeBoundTimes objectAtIndex:row]; } else if ([tableView tag] == 1) { cell.arriveTimeLabel.text = [workBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [workBoundTimes objectAtIndex:row]; } return cell; } Is it possible that its only getting called when the top cell is being called?

    Read the article

  • Graphical glitches when adding cells and scrolling with UITableView

    - by Daniel I-S
    I am using a UITableView to display the results of a series of calculations. When the user hits 'calculate', I wish to add the latest result to the screen. This is done by adding a new cell to a 'results' section. The UITableViewCell object is added to an array, and then I use the following code to add this new row to what is displayed on the screen: [thisView beginUpdates]; [thisView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation: UITableViewRowAnimationFade]; [thisView endUpdates]; This results in the new cell being displayed. However, I then want to immediately scroll the screen down so that the new cell is the lowermost cell on-screen. I use the following code: [thisView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; This almost works great. However, the first time a cell is added and scrolled to, it appears onscreen only briefly before vanishing. The view scrolls down to the correct place, but the cell is not there. Scrolling the view by hand until this invisible new cell's position is offscreen, then back again, causes the cell to appear - after which it behaves normally. This only happens the first time a cell is added; subsequent cells don't have this problem. It also happens regardless of the combination of scrollToRowAtIndexPath and insertRowsAtIndexPath animation settings. There is also a problem where, if new cells are added repeatedly and quickly, the new cells stop 'connecting up'. The lowermost cell in a group is supposed to have rounded corners, and when a new cell is added these turn into square corners so that there is a clean join with the next cell in the group. In this case, however, a cell often does not lose its rounded edges despite not being the last cell anymore. This also gets corrected once the affected area moves offscreen and back. This method of adding and scrolling would be perfect for my application if it weren't for these weird glitches. Any ideas as to what I may be doing wrong?

    Read the article

  • UITableView with dynamic cell heights -- what do I need to do to fix scrolling down?

    - by Ian Terrell
    I am building a teensy tiny little Twitter client on the iPhone. Naturally, I'm displaying the tweets in a UITableView, and they are of course of varying lengths. I'm dynamically changing the height of the cell based on the text quite fine: - (CGFloat)heightForTweetCellWithString:(NSString *)text { CGFloat height = Buffer + [text sizeWithFont:Font constrainedToSize:Size lineBreakMode:LineBreakMode].height; return MAX(height, MinHeight); } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *text = // get tweet text for this indexpath return [self heightForTweetCellWithString:text]; } } I'm displaying the actual tweet cell using the algorithm in the PragProg book: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"TweetCell"; TweetCell *cell = (TweetCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [self createNewTweetCellFromNib]; } cell.tweet.text = // tweet text // set other labels, etc return cell; } When I boot up, all the tweets visible display just fine. However, when I scroll down, the tweets below are quite mussed up -- it appears that once a cell has scrolled off the screen, the cell height for the one above it gets resized to be larger than it should be, and obscures part of the cell below it. When the cell reaches the top of the view, it resets itself and renders properly. Scrolling up presents no difficulties. Here is a video that shows this in action: http://screencast.com/t/rqwD9tpdltd I've tried quite a bit already: resizing the cell's frame on creation, using different identifiers for cells with different heights (i.e. [NSString stringWithFormat:@"Identifier%d", rowHeight]), changing properties in Interface Builder... If there are additional code snippets I can post, please let me know. Thanks in advance for your help!

    Read the article

  • Black Corners On Grouped UITableViewCells Only After Navigation Pops

    - by coneybeare
    I am not graphics expert but I somehow managed to make some good looking custom grouped UITableViewCells by setting the background view to a backgroundView with some CG code. In all SDK's up to 3.1.3 (maybe 3.2... I haven't tested on the iPad) this was working great, but I think a more recent SDK has introduced a change in the way graphics are cached offscreen. Upon first render, everything is great: The drawing is fine and the corners are transparent. If I push a couple of view controllers on the navigation stack and come back, there are now black corners that appear in the views: BEFORE && AFTER I have tons of code, most of which is written up here. I have tried tweaking to the best of my ability, looking at the docs for applicable changes, but after at least 8 hours in I still cannot find what might cause this. I have tried setting every view I can think of to be backgroundColor=clearColor and opaque=NO What else am I missing? Any debugging tips? UPDATE: I have some debug code in viewDidAppear that prints the backgroundColor and class description of all the subviews. - (void)debugView:(UIView *)view { DebugLog(@"%@ - %@", view.backgroundColor, [[view class] description]); for (UIView* child in view.subviews) { [self debugView:child]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [DownloadController.networkQueue setSuspended:NO]; for (TTTableViewCell *cell in [self.tableView visibleCells]) { [cell debugView:cell]; } } With this code, I inspect the backgroundColor settings of the cell views on first load, when it is fine, and then again after coming back. There are some differences, but all the colors are still set to be clear. This leads me to believe the issue is underneath the UITableViewCell. UPDATE 2: I have created a simple sample application to highlight the problem here

    Read the article

  • Clear tableView cell cache (or remove an entry)

    - by ManniAT
    Hi, I have the same question problem as described here http://stackoverflow.com/questions/2286669/iphone-how-to-purge-a-cached-uitableviewcell But my problem can't be solved with "resetting content". To be precise - I use a custom cell (own class). While running the application it is possible that I have to use a different "cell type". It's the same class - but it has (a lot of) differnt attributes. Of course I could always reset all the things at "PrepareForReuse" but that's not a good idea I guess (there are a lot things to reset). My idea - I do all these things in the constructor of the cell. And all the rows will use this "type of cell" later. When the (seldom) situation comes that I have to change the look of all rows I create a new instance of this kind of cell with different settings. And now I want to replace the queued cell with this new one. I tried it with simply calling the constructor with the same cellidentifier (in the hope it will replace the existing one) but that doesn't work. I also didn't find a "ClearReusableCells" or something like this. Is there a way to clear the cache - or to remove / replace a specific item? Manfred

    Read the article

  • Detecting when a cell's detail-disclosure button has been clicked (when using a custom cell XIB)

    - by Gloria
    1 if (cell == nil) 2 { 3 [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; 4 cell = tvCell; 5 self.tvCell = nil; 6 } There's some code from an Apple example of using your own "custom cell XIB" to create cells in a UITableView. It appears to work... but I think I would do better to actually UNDERSTAND what is being done there. Why isn't line #3 assigning the value TO something? cell = [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; (In fact, cell and tvCell aren't being used at all.) Why is line #4 assigning using tvCell when nothing has been put it in at all, yet? Why is line #5 nulling out the tvCell that I need? Why is "@property (nonatomic, assign) IBOutlet UITableViewCell *tvCell;" using assign, not retain? About the only thing I can't get working correctly is when I put a disclosure-button on my custom cell XIB. Is there a way for me to detect when the user has clicked on it? (Hopefully, without using 100s of TAGs.)

    Read the article

  • How to fix a slow scrolling table view

    - by hanumanDev
    I have a table view that's scrolling slowly. Does anyone know why that might be? There is an image for each row, but even after the images are loaded it still stutters and scrolls slowly. thanks for any help here's my code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"SimpleTableCell"; SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } // Get item from tableData NSDictionary *item = (NSDictionary *)[displayItems objectAtIndex:indexPath.row]; // display the youdeal deal image photoString = [item objectForKey:@"image"]; UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:photoString]]]; cell.titleLabel.text = [item objectForKey:@"supercat"]; cell.descriptionLabel.text = [item objectForKey:@"title"]; NSString *convertedLeftCount = [NSString stringWithFormat:@"%@",[item objectForKey:@"left_count"]]; cell.amountLabel.text = convertedLeftCount; cell.thumbnailImageView.image = image; cell.priceLabel.text = [item objectForKey:@"cat"]; return cell; }

    Read the article

  • Can't give my custom prototype cells in tableview different heights

    - by kerbelda
    I've looked around at other questions here and many other sources online and just can't find a solution. I have 3 rows and no matter what I do, they all keep the width defined in the tableview. The first one is what I want, but the second and 3rd I can't give a custom height. Below is my code: #import "DetailTableViewController.h" #import "EventDetailTableViewCell.h" #import "EventDescriptionTableViewCell.h" #import "EventMapTableViewCell.h" @interface DetailTableViewController () @end @implementation DetailTableViewController - (void)viewDidLoad { [super viewDidLoad]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 3; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { static NSString *CellIdentifier = @"headerCell"; EventDetailTableViewCell *headerCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; headerCell.headerImage.image = [UIImage imageNamed:@"img4.png"]; return headerCell; } else if (indexPath.section == 1) { static NSString *CellIdentifier = @"descriptionCell"; EventDescriptionTableViewCell *descriptionCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; descriptionCell.descriptionImage.image = [UIImage imageNamed:@"img2.png"]; return descriptionCell; } else { static NSString *CellIdentifier = @"mapCell"; EventMapTableViewCell *mapCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; return mapCell; } } #pragma mark - Helper Methods - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if (section == 1) { return @" "; } else if (section == 2) { return @" "; } else { return nil; } } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 0) { return 222; } else if (indexPath.row == 1) { return 80; } else { return 100; } } @end

    Read the article

  • UITableViewCell repeating problem

    - by cannyboy
    I have a UItableview with cells. Some cells have uilabels and some have uibuttons. The UIbuttons are created whenever the first character in an array is "^". However, the uibuttons repeat when i scroll down (appearing over the uilabel).. and then multiply over the uilabels when I scroll up. Any clues why? My voluminous code is below: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { const NSInteger LABEL_TAG = 1001; UILabel *label; UIButton *linkButton; //NSString *linkString; static NSString *CellIdentifier; UITableViewCell *cell; CellIdentifier = @"TableCell"; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; label = [[UILabel alloc] initWithFrame:CGRectZero]; [cell.contentView addSubview:label]; [label setLineBreakMode:UILineBreakModeWordWrap]; [label setMinimumFontSize:FONT_SIZE]; [label setNumberOfLines:0]; //[label setBackgroundColor:[UIColor redColor]]; [label setTag:LABEL_TAG]; NSString *firstChar = [[paragraphs objectAtIndex:indexPath.row] substringToIndex:1]; NSLog(@"firstChar %@", firstChar); NSLog(@"before comparison"); if ([firstChar isEqualToString:@"^"]) { // not called NSLog(@"BUTTON"); //[label setFont:[UIFont boldSystemFontOfSize:FONT_SIZE]]; linkButton = [UIButton buttonWithType:UIButtonTypeCustom]; linkButton.frame = CGRectMake(CELL_CONTENT_MARGIN, CELL_CONTENT_MARGIN, 280, 30); [cell.contentView addSubview:linkButton]; NSString *myString = [paragraphs objectAtIndex:indexPath.row]; NSArray *myArray = [myString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"*"]]; NSString *noHash = [myArray objectAtIndex:1]; [linkButton setBackgroundImage:[UIImage imageNamed:@"linkButton.png"] forState:UIControlStateNormal]; linkButton.adjustsImageWhenHighlighted = YES; [linkButton setTitle:noHash forState:UIControlStateNormal]; linkButton.titleLabel.font = [UIFont systemFontOfSize:FONT_SIZE]; [linkButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [linkButton setTag:indexPath.row]; [linkButton addTarget:self action:@selector(openSafari:) forControlEvents:UIControlEventTouchUpInside]; //size = [noAsterisks sizeWithFont:[UIFont boldSystemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; [label setBackgroundColor:[UIColor clearColor]]; [label setText:@""]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { label = (UILabel *)[cell viewWithTag:LABEL_TAG]; NSString *firstChar = [[paragraphs objectAtIndex:indexPath.row] substringToIndex:1]; NSLog(@"firstChar %@", firstChar); NSLog(@"before comparison"); if ([firstChar isEqualToString:@"^"]) { NSLog(@"cell not nil, reusing linkButton"); linkButton = (UIButton *)[cell viewWithTag:indexPath.row]; } } if (!label) label = (UILabel*)[cell viewWithTag:LABEL_TAG]; NSString *textString = [paragraphs objectAtIndex:indexPath.row]; NSString *noAsterisks = [textString stringByReplacingOccurrencesOfString:@"*" withString:@""] ; CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f); CGSize size; NSString *firstChar = [[paragraphs objectAtIndex:indexPath.row] substringToIndex:1]; //NSLog(@"firstChar %@", firstChar); if ([firstChar isEqualToString:@"^"]) { NSLog(@"BUTTON2"); if (!linkButton) linkButton = (UIButton*)[cell viewWithTag:indexPath.row]; linkButton = [UIButton buttonWithType:UIButtonTypeCustom]; linkButton.frame = CGRectMake(CELL_CONTENT_MARGIN, CELL_CONTENT_MARGIN, 280, 30); [cell.contentView addSubview:linkButton]; NSString *myString = [paragraphs objectAtIndex:indexPath.row]; NSArray *myArray = [myString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"*"]]; NSString *noHash = [myArray objectAtIndex:1]; [linkButton setBackgroundImage:[UIImage imageNamed:@"linkButton.png"] forState:UIControlStateNormal]; linkButton.adjustsImageWhenHighlighted = YES; [linkButton setTitle:noHash forState:UIControlStateNormal]; linkButton.titleLabel.font = [UIFont systemFontOfSize:FONT_SIZE]; [linkButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [linkButton setTag:indexPath.row]; [linkButton addTarget:self action:@selector(openSafari:) forControlEvents:UIControlEventTouchUpInside]; size = [noAsterisks sizeWithFont:[UIFont boldSystemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; [label setBackgroundColor:[UIColor clearColor]]; [label setText:@""]; } else if ([firstChar isEqualToString:@"*"]) { size = [noAsterisks sizeWithFont:[UIFont boldSystemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; [label setFont:[UIFont boldSystemFontOfSize:FONT_SIZE]]; [label setText:noAsterisks]; NSLog(@"bold"); } else { size = [noAsterisks sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; [label setFont:[UIFont systemFontOfSize:FONT_SIZE]]; [label setText:noAsterisks]; } [label setFrame:CGRectMake(CELL_CONTENT_MARGIN, CELL_CONTENT_MARGIN, CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), MAX(size.height, 20.0f))]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.accessoryType = UITableViewCellAccessoryNone; return cell; }

    Read the article

  • Properly setting up willSelectRowAtIndexPath and didSelectRowAtIndexPath to send cell selections

    - by Gordon Fontenot
    Feel like I'm going a bit nutty here. I have a detail view with a few stand-alone UITextFields, a few UITextFields in UITAbleViewCells, and one single UITableViewCell that will be used to hold notes, if there are any. I only want this cell selectable when I am in edit mode. When I am not in edit mode, I do not want to be able to select it. Selecting the cell (while in edit mode) will fire a method that will init a new view. I know this is very easy, but I am missing something somewhere. Here are the current selection methods I am using: -(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (!self.editing) { NSLog(@"Returning nil, not in edit mode"); return nil; } NSLog(@"Cell will be selected, not in edit mode"); if (indexPath.section == 0) { NSLog(@"Comments cell will be selected"); return indexPath; } return nil; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (!self.editing) { NSLog(@"Not in edit mode. Should not have made it this far."); return; } if (indexPath.section == 0) [self pushCommentsView]; else return; } My problem is really 2 fold; 1) Even when I'm not in edit mode, and I know I am returning nil (due to the NSLog message), I can still select the row (it flashes blue). From my understanding of the willSelectRowAtIndexPath method, this shouldn't be happening. Maybe I am wrong about this? 2) When I enter edit mode, I can't select anything at all. the willSelectRowAtIndexPath method never fires, and neither does the didSelectRowAtIndexPath. The only thing I am doing in the setEditing method, is hiding the back button while editing, and assigning firstResponder to the top textField to get the keyboard to pop up. I thought maybe the first responder was getting in the way of the click (which would be dumb), but even with that commented out, I cannot perform the cell selection during editing.

    Read the article

  • Resize UITableViewCell to show image at maximum size

    - by Mike
    I want to show some images and text in a UITableView. But when I add the image to its UITableViewCell it breaks the layout and overlaps with the next Header. How can I set the size of the cell containing the image, so that the layout doesn't get broken? I found some ObjC-Code which suggest this can be done by using heightForRowAtIndexPath, but I couldn't find anything MonoTouch specific.

    Read the article

  • How do I selectively round UITableViewCell corners?

    - by Michael Yang
    I'm trying to recreate the feel of the upper part of the iPhone Stocks application. Using cornerRadius I have been able to round all the corners of the UITableView, but when the user drags too far down or up the rectangular edges of the first and last cells show. How can I round only the top or bottom part of the UITableViewCell?

    Read the article

  • Hiding UITableViewCell

    - by live2dream95
    Is there a way to hide a UITableView cell? I'm looking for some property or method I can invoke on the UITableViewCell returned by a synchronous cellForRowAtIndexPath() to hide it and make it unselectable by the user.

    Read the article

  • UIWebView inside the UITableViewCell

    - by Nilshan
    I want to develop iPhone UI just like iPhone Mail application. I am able to add UIWebView inside the UITableViewCell and it is working fine. I am able to zoom the webview using [self.webView setScalesPageToFit:YES]. Now, My problem is when I do zoomIn or ZoomOut the UITableView does not get resized. How do I exactly make UI similar to Apple mail applcation detail view.?

    Read the article

  • UITableViewCell separator line disappears on scroll

    - by iconso
    I'm trying to have a separator cell with a custom image. I did try something like that: In my cellForRowAtIndexPath: NSString *cellIdentifier = [NSString stringWithFormat:@"identifier"]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier]; } cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:19]; cell.textLabel.text = [self.menuItems objectAtIndex:indexPath.row]; cell.textLabel.textColor = [UIColor colorWithRed:128/255.0f green:129/255.0f blue:132/255.0f alpha:1.0f]; cell.backgroundColor = [UIColor whiteColor]; UIImageView *imagView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"reaL.png"]]; imagView.frame = CGRectMake(0, cellHeight, cellWidth, 1); [cell.contentView addSubview:imagView]; switch (indexPath.row) { case 0: cell.imageView.image = [self imageWithImage:[UIImage imageNamed:@"img1.png"] scaledToSize:CGSizeMake(27, 27)]; cell.imageView.highlightedImage = [self imageWithImage:[UIImage imageNamed:@"route.png"] scaledToSize:CGSizeMake(27, 27)]; break; case 1: cell.imageView.image = [self imageWithImage:[UIImage imageNamed:@"img.png"] scaledToSize:CGSizeMake(27, 27)]; cell.imageView.highlightedImage = [self imageWithImage:[UIImage imageNamed:@"money.png"] scaledToSize:CGSizeMake(27, 27)]; break; case 2: cell.imageView.image = [self imageWithImage:[UIImage imageNamed:@"auto.png"] scaledToSize:CGSizeMake(27, 27)]; cell.imageView.highlightedImage = [self imageWithImage:[UIImage imageNamed:@"cars.png"] scaledToSize:CGSizeMake(27, 27)]; break; case 3: cell.imageView.image = [self imageWithImage:[UIImage imageNamed:@"impostazioni.png"] scaledToSize:CGSizeMake(27, 27)]; cell.imageView.highlightedImage = [self imageWithImage:[UIImage imageNamed:@"impostazioni.png"] scaledToSize:CGSizeMake(27, 27)]; // cell.imageView.contentMode = UIViewContentModeScaleAspectFill; break; case 4: cell.imageView.image = [self imageWithImage:[UIImage imageNamed:@"info.png"] scaledToSize:CGSizeMake(27, 27)]; cell.imageView.highlightedImage = [self imageWithImage:[UIImage imageNamed:@"info.png"] scaledToSize:CGSizeMake(27, 27)]; break; default: break; } return cell; When I lunch the app everything is good, but when I scroll the the table, or when I select a cell the separator lines disappear. How I can have a permanent custom line separator?

    Read the article

  • How to add picture in UITableViewCell

    - by Dan
    I'm new to Iphone application development and objective C. I wonder if there is a way to insert a picture in a UITableViewCell - with or without creating a custom cell? I would like to have it positioned at the "second row" in the same way that "cell.detailTextLabel.text" appear. Any suggestions? Thanks in advance.

    Read the article

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