Search Results

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

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

  • Changing a custom accessoryView in a uitableviewcell?

    - by cannyboy
    I'm trying to change the custom accessoryView of a uitableviewcell immediately after the user clicks on the cell. How would I do this? For the record, I'm using Matt Gallagher' custom table view tutorial: http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html Download link for source: http://projectswithlove.com/projects/EasyCustomTable.zip

    Read the article

  • UITableViewCell with 'ball' like calendar App

    - by Stuart Tevendale
    in the iPhone Calendar app, the view to select the calendar for a particular event has a coloured circle next to the calendar name, drawn with a graduated/3D effect of a ball. Does anyone have any sample code for how this is drawn - I can draw a solid circle in the UITableViewCell, but I'm not sure how to get the 3D effect. Thanks.

    Read the article

  • Programatically created UITableViewCell subclass only working on highlight

    - by squarefrog
    I've created a subclass of UITableViewCell but I'm struggling to get it to work properly. If I use UITableViewStyleDefault then the class only works when highlighted. If I use UITableViewStyleValue1 then it mostly works but I'm unable to change label fonts much. I tried researching but it seems everyone is doing this via a .xib file, but not programatically. Implementation file #import "ASCustomCellWithCount.h" @implementation ASCustomCellWithCount @synthesize primaryLabel,secondaryLabel,contentCountImage,contentCount; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code contentCountImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"tableCount.png"] ]; primaryLabel = [[UILabel alloc] init]; primaryLabel.textAlignment = UITextAlignmentLeft; primaryLabel.textColor = [UIColor blackColor]; primaryLabel.font = [UIFont systemFontOfSize: 20]; primaryLabel.backgroundColor = [UIColor clearColor]; secondaryLabel = [[UILabel alloc] init]; secondaryLabel.textAlignment = UITextAlignmentLeft; secondaryLabel.textColor = [UIColor blackColor]; secondaryLabel.font = [UIFont systemFontOfSize: 8]; secondaryLabel.backgroundColor = [UIColor clearColor]; contentCount = [[UILabel alloc] init]; contentCount.textAlignment = UITextAlignmentCenter; contentCount.font = [UIFont boldSystemFontOfSize: 15]; contentCount.textColor = [UIColor whiteColor]; contentCount.shadowColor = [UIColor blackColor]; contentCount.shadowOffset = CGSizeMake(1, 1); contentCount.backgroundColor = [UIColor clearColor]; [self.contentView addSubview: contentCountImage]; [self.contentView addSubview: primaryLabel]; [self.contentView addSubview: secondaryLabel]; [self.contentView addSubview: contentCount]; } return self; } - (void)layoutSubviews { [super layoutSubviews]; CGRect contentRect = self.contentView.bounds; // CGFloat boundsX = contentRect.origin.x; primaryLabel.frame = CGRectMake(0 ,0, 200, 25); secondaryLabel.frame = CGRectMake(0, 30, 100, 15); contentCount.frame = CGRectMake(contentRect.size.width - 48, contentRect.size.height / 2 - 13, 36, 24); contentCountImage.frame = CGRectMake(contentRect.size.width - 48, contentRect.size.height / 2 - 12, 36, 24); } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)dealloc { [primaryLabel release]; [secondaryLabel release]; [contentCountImage release]; [contentCount release]; } @end And then to create the cell I use - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; ASCustomCellWithCount *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[ASCustomCellWithCount alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text = [NSString stringWithFormat:@"%@", [tempArray objectAtIndex: indexPath.row]]; cell.contentCount.text = @"49"; return cell; }

    Read the article

  • UITableViewCell similar to one in "Things" app

    - by Fiedorowski
    Hi im looking (but cant find) for sample app that will show me how to implement UITableView with custom UITableViewCell that is similar to one in the Things app, with smooth animation from read-only view (that hides empty cells) to editable view that shows only cells that can be edited, and custom cell with multiline input with small image. I would appreciate if someone could point me in the right direction. Im new to Cocoa/Objective-C programming but Im familiar with Object Oriented programing concepts.

    Read the article

  • UITableViewCell with custom gradient background, with another gradient as highlight color

    - by Rich
    I have a custom UITableViewCell with a custom layout. I wanted a gradient background, so in my UITableViewDelegate cellForRowAtIndexPath: method, I create a CAGradientLayer and add it to the cell's layer with insertSubLayer:atIndex: (using index 0). This works just fine except for two things: Most importantly, I can't figure out how to change to a different gradient color when the row is highlighted. I have tried a couple things, but I'm just not familiar enough with the framework to get it working. Where would be the ideal place to put that code, inside the table delegate or the cell itself? Also, there's a 1px white space in between each cell in the table. I have a background color on the main view, a background color on the table, and a background color on the cell. Is there some kind of padding or spacer by default in a UITableView?

    Read the article

  • UIButton disappears inside selected UITableViewCell

    - by Mike
    I have a table, I have cellForRowAtIndexPath delegate for it and I have instance of UITableViewCell being created inside that method, which I return. Somewhere in cellForRowAtIndexPath I also add UIButton to cell.contentView of that cell. It all works fine, until I select that cell with button in it. The cell changes color to blue (which is ok), uibutton changes its color to blue too. Now, if I click on that UIButton inside selected cell, it just disappears! Wow, that's weird, how do I fix it? I want UIButton inside selected cell to stay, when I click it.

    Read the article

  • Reference from UITableViewCell to UITableView to UINavigationController

    - by Nick
    If the user taps and holds on a Foo table view cell for 2 seconds, a modal view should be shown. The modal view is also displayed when a new Foo is added to the cell. The modal view's delegate protocol is implemented by the parent UITableView subclass. My tap and hold detection code is in the Foo UITableViewCell class. I'm having difficulty referencing the parent tableview's navigation controller to display the modal view. FooModalViewController *modalController = [[FooModalViewController alloc] initWithNibName:@"FooModalViewController" bundle:nil]; FooTableViewController *tableView = (FooTableViewController *) self.superview; foo.delegate = tableView; Seems OK but I'm having problems referencing the navigation controller that contains the tableview.. The code below builds OK but throws an exception - NSOBject DoesNotRecognizeSelector. UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController]; [[tableView.navigationController] presentModalViewController:navigationController animated:YES]; I think that perhaps my design is flawed..?

    Read the article

  • Growing UITextView and UITableViewCell

    - by Arie Pieter
    I'd like to emulate the compose mail screen of Apples iPhone app. At this moment I have a UITableView with some cells. The last cell contains a UITextView. I managed to get the scrolling the way I like, but one problem remains: how to let the UITextView and the UITableViewCell automatically grow in height when the user enters a new line of text? There has been written a lot about this, I know. But I couldn't find any solution. Can anybody help me or just give a hint? Thanks APC

    Read the article

  • Drawing selected state on custom UITableViewCell

    - by Brian
    So I have a customer UITableViewCell whose whole display in drawn in drawRect. When it draws it creates CGLayers so that it can reuse certain pieces when something is changed. I have changed my UITableViewCellSelectionStyle to None because I don't want the default selected view to cover my drawing. So I call setNeedsDisplay in setSelected:animated: for my cell. But by the time drawRect is called, setSelected:animated: has already been called again to deselect the cell. In my table view controller in didSelectRowAtIndexPath I call deselectRowAtIndexPath as Apple advises. Any ideas? Thanks.

    Read the article

  • Telling a UITextField to become first responder while embedded in a UITableViewCell

    - by Jasarien
    I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I am trying: [myTextField becomeFirstResponder]; This returns NO all the time, regardless of when it's called, which according to the docs means the text field refused to become first responder... What am I doing wrong? Edit: The text field properly responds to being touched. It bring up the keyboard then. It's only when telling it to become first responder programmatically that the problem happens.

    Read the article

  • Autoresizing subclassed UITableViewCell subviews

    - by JustinXXVII
    I've subclassed UITableViewCell and incorporated some subviews via the layoutSubviews method. All views are allocated and initiated in the initWithStyle method, and frames are set in the layoutSubviews method, like so: initWithStyle:... { UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectZero]; myLabel.someProperties = Configured; [self.contentView addSubview:myLabel]; layoutSubviews { CGRect labelRect = CGRectMake(10.0f, 5.0f, 35.0f, 180.0f); myLabel.frame = labelRect; Setting the shouldAutoRotateOrientation to YES in the viewController rotates the NavigationController, tableView and UIToolbar appropriately, but the contents of the tableViewCells don't move. I'm not clear on where or what to add as far as AutoResizingMasks. The combinations I've tried so far haven't done anything. Can someone give me a hand? Thanks!

    Read the article

  • The accossoryView of a UITableViewCell disappears after the visible view is changed

    - by Luca
    Hi! I'm experiencing this strange situation. I have a UITableView where, when the user selects a cell, a long (network) process begins. So, I performed this in a background thread and I placed (in the didSelectRowAtIndexPath) a UIActivityIndicatorView as the accessory view. This is what I wrote: UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]; UIActivityIndicatorView* activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; cell.accessoryView = activityView; [activityView startAnimating]; [activityView release]; everything seems to work correctly, except that, if during a loading process (when the indicator is animated), I switch the view using a UITabBar, when I go back to the UITableView, the UIActivityIndicatorView that should still be there has disappeared. Any idea of what I did wrong? Thanks!

    Read the article

  • iPhone: change height of UITableViewCell coming from a NIB

    - by Stefan Klumpp
    I have a UITableView of custom UITableViewCells which looks like this: [ CELL 0 [ description ] [ dynamic content type 1 ] [ dynamic content type 2 ] [ dynamic content type 3 ] ] [ CELL 1 [ description ] [ dynamic content type 1 ] [ dynamic content type 3 ] ] [ CELL 2 [ description ] [ dynamic content type 2 ] ] [ ... and so on ... ] Since the [description] part is already pretty complex I decided to use Interface Builder to design it and at add the [dynamic content] in the cellForRowAtIndexPath programmatically with [cell addSubview:...]. My problem is now, that I set a default height for my custom UITableViewCell in Interface Builder, but when I add my [dynamic content] (which might range between 0..3) I have different cells with different heights. One thing is of course to calculate the total height and change the return value in heightForRowAtIndexPath, but how do I change the height value of my actual cell (which was loaded from a nib file with a fixed height)?

    Read the article

  • UITableView subview to uitableviewcell

    - by Dave
    i am trying to add a button to the tableview and no matter what frame i specify the button is not visible. This is a custom UITableViewCell and I am adding the button in the code rather than in the xib file is so that I can click on the button and perform an action which is not didSelectRowAtIndexPath: I have the following code in cellForRowAtIndexPath: What am I missing? UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; button.titleLabel.text = @"detail"; button.frame = bframe; button.userInteractionEnabled = YES; [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; [cell.contentView addSubview:button]; return cell;

    Read the article

  • Question about select UITableViewCell fields

    - by Joaquin McCoy
    Hi guys, I've a custom UITableViewCell like this: +--------------------------+ | username | | | | --- <image> -- | | | | <like it> | +--------------------------+ It display an username, an image and a button "Like it" to like image. I don't want that the entire cell is selectable, I want a user can tap on "username" to see a new view that show username information. The same for image, when user tap on image, he could see the image in a new view. Now I can only select my entire cell. How can I implement something like this? Thanks. When you click on the username you'll see a view for user information. The entire cell is not selectable.

    Read the article

  • How to make an scrollable UITextField Inside UItableViewCell?

    - by user333624
    Hello everyone. I created a bunch of editable UITableViewCell by embedding an UITextField inside, but I have seen some apps that allows you to scroll the UItableview by scrolling inside an inactive editable cell. How can I do that? And how can I also dismiss the keyboard when tapping somewhere else? I know about the method: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; if (touch.tapCount == 1) { [self resignFirstResponder]; } else { }} I put it inside my custom table view controller but the method doesn't seem to be called upon a tap, and I don't know if even if it gets called will dismiss the keyboard. Any help will be appreciated.

    Read the article

  • iPhone UITableViewCell: repositioning the textLabel

    - by user359784
    Hello, I am new to iPhone development and I am currently working on a simple RSS reader app. The problem I am having is that I need to reposition the textLabel inside the UITableViewCells. I have tried setFrame or setCenter but it doesn't do anything. Does anyone know what I need to do inside the tableView:cellForRowAtIndexPath: method to reposition the textLabel at the top of the cell (x = 0, y = 0)? Thank you PS: The UITableViewCell is referenced by a variable called cell. I have tried [cell setFrame:CGRectMake(0, 0, 320, 20)] with no success.

    Read the article

  • How to place a Rounded Rect UIBUTTON on UITableViewCell programmatically

    - by Tobias
    I was trying to place two uibuttons on uitableviewcell programmatically.. but unable to achieve that. somehow i managed to get the buttons through some sample project in which u can draw a nib for cell.. but i was unable to set a selector function for buttons.. in other example i can place a uiinfodark type button but when i change the type to rounded rect the button gets disappeared and i am unable to figure out why? I might be doing some silly mistake but I am really kinda stuck with it right now so I'll be very much thankful to all of you for helping in this regard.

    Read the article

  • Changing UITableViewCell textLabel background color to clear

    - by SorinA.
    In my app i have a table view with customViewCells. i subclassed the UITableViewCell class and added an image that will load async and for the text i use cell.textLabel.text = @"someThext". for the cells the background color is set alternatively to [UIColor darkGrayColor] and whitecolor. When i run the app in the simulator and on the pone the textLabel of the cell has the background white. I want to set it to be clear, because i want the background color of the cell to be full not a strip then white then another strip. in the init method of my custom cell i added hoping that the white will turn into red but it doesn't have any effect. [self.textLabel setBackgroundColor:[UIColor redColor]]; i tried also self.textLabel.backgroundColor = [UIColor redColor]; but this also didn't work...if i add a UILabel as a subview the background color of the label can be set..but i don't want to do that because when i rotate the phone i want my labels to auto enlarge... any ideas why setting the background color of cell.textLabel doesn't work? thank you

    Read the article

  • UIWebView in custom UITableViewCell

    - by mlecho
    i am not sure if this is a good route to go,...i have some data i receive from the web which in turn, populates a table view. The problem is, the text is html (p tags, etc). My first thought was to create a uiwebview in the cell, and populate with loadHTMLString. Fact is , it KINDA works. But, i then the cell no longer was the recipient of touches. SO, before we get too deep in code, is there a better way to populate the cells, than using a UIWebView. It feels like a hack, and i fear even if it works, apple would turn it away. //from my custom UITableViewCell class: - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) { [self setFrame:frame]; webcell = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,frame.size.width-20,frame.size.height)]; [self.contentView addSubview:webcell]; //bloack the webview from touches UIView *cover = [[UIView alloc] initWithFrame:webcell.frame]; [self.contentView addSubview:cover]; [cover release]; } return self; } -(void)setLabelData:(FeedItem *)feedItem { link = feedItem.link; NSMutableString *htmlstring = [NSMutableString string]; [htmlstring appendString:@"<html><head><link rel='stylesheet' href='style.css'/></head><body>"]; [htmlstring appendFormat:@"<p>%@</p>",feedItem.title]; [htmlstring appendFormat:@"<p>%@</p>",feedItem.description]; [htmlstring appendString:@"</body></html>"]; [webcell loadHTMLString:htmlstring baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]]; } thanks

    Read the article

  • Optimizing drawing on UITableViewCell

    - by Brian
    I am drawing content to a UITableViewCell and it is working well, but I'm trying to understand if there is a better way of doing this. Each cell has the following components: Thumbnail on the left side - could come from server so it is loaded async Title String - variable length so each cell could be different height Timestamp String Gradient background - the gradient goes from the top of the cell to the bottom and is semi-transparent so that background colors shine through with a gloss It currently works well. The drawing occurs as follows: UITableViewController inits/reuses a cell, sets needed data, and calls [cell setNeedsDisplay] The cell has a CALayer for the thumbnail - thumbnailLayer In the cell's drawRect it draws the gradient background and the two strings The cell's drawRect it then calls setIcon - which gets the thumbnail and sets the image as the contents of the thumbnailLayer. If the image is not found locally, it sets a loading image as the contents of the thumbnailLayer and asynchronously gets the thumbnail. Once the thumbnail is received, it is reset by calling setIcon again & resets the thumbnailLayer.contents This all currently works, but using Instruments I see that the thumbnail is compositing with the gradient. I have tried the following to fix this: setting the cell's backgroundView to a view whose drawRect would draw the gradient so that the cell's drawRect could draw the thumbnail and using setNeedsDisplayInRect would allow me to only redraw the thumbnail after it loaded --- but this resulted in the backgroundView's drawing (gradient) covering the cell's drawing (text). I would just draw the thumbnail in the cell's drawRect, but when setNeedsDisplay is called, drawRect will just overlap another image and the loading image may show through. I would clear the rect, but then I would have to redraw the gradient. I would try to draw the gradient in a CAGradientLayer and store a reference to it, so I can quickly redraw it, but I figured I'd have to redraw the gradient if the cell's height changes. Any ideas? I'm sure I'm missing something so any help would be great.

    Read the article

  • UITableViewCell checkmarks

    - by burki
    Hi! When you select a cell in the UITableView, the - (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)indexPath is called. There some of the NSManagedObjects will be updated with the right values and the row will be deselected. Well, it works all right, but you can't see any selection of the tableviewcell. I found out that the access on core data causes the problem, that means, if i comment out the lines with the commands of updating the NSManagedObjects, it all works like I want, with a smooth selection and deselection. Can anybody help? Thanks. - (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //[table deselectRowAtIndexPath:indexPath animated:YES]; NSMutableSet *favoriteGroups = [NSMutableSet setWithSet:element.favoriteGroup]; NSMutableSet *elements = [NSMutableSet setWithSet:[(FavoriteGroup *)[fetchedResultsController objectAtIndexPath:indexPath] element]]; UITableViewCell *checkedCell = [table cellForRowAtIndexPath:indexPath]; if (checkedCell.accessoryType == UITableViewCellAccessoryCheckmark) { [elements removeObject:element]; [favoriteGroups removeObject:[fetchedResultsController objectAtIndexPath:indexPath]]; [[table cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryNone]; } else { [elements addObject:element]; [favoriteGroups addObject:[fetchedResultsController objectAtIndexPath:indexPath]]; [[table cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark]; } element.favoriteGroup = favoriteGroups; FavoriteGroup *favoriteGroup = [self.fetchedResultsController objectAtIndexPath:indexPath]; favoriteGroup.element = elements; [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; }

    Read the article

  • Custom UITableViewCell trouble with UIAccessibility elements

    - by ojreadmore
    No matter what I try, I can't keep my custom UITableViewCell from acting like it should under the default rules for UIAccessiblity. I don't want this cell to act like an accessibility container (per se), so following this guide I should be able to make all of my subviews accessible, right?! It says to make each element accessible separately and make sure the cell itself is not accessible. - (BOOL)isAccessibilityElement { return NO; } - (NSString *)accessibilityLabel { return nil; } - (NSInteger)accessibilityElementCount { return 0; } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier //cells use this reusage stuff { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self setIsAccessibilityElement:NO]; sub1 = [[UILabel alloc] initWithFrame:CGRectMake(0,0,1,1)]; [sub1 setAccessibilityLanguage:@"es"]; [sub1 setIsAccessibilityElement:YES]; [sub1 setAccessibilityLabel:sub1.text] sub2 = [[UILabel alloc] initWithFrame:CGRectMake(0,0,1,1)]; [sub2 setAccessibilityLanguage:@"es"]; [sub2 setIsAccessibilityElement:YES]; [sub2 setAccessibilityLabel:sub2.text] The voice over system reads the contents of the whole cell all at once, even though I'm trying to stop that behavior. I could say [sub2 setIsAccessibilityElement:NO]; but that would would make this element entirely unreadable. I want to keep it readable, but not have the whole cell be treated like a container (and assumed to be the English language). There does not appear to be a lot of information out there on this, so at the very least I'd like to document it.

    Read the article

  • Problem setting dynamic UITableViewCell height

    - by HiveHicks
    I've got a UITableView with two dynamic rows. Each of the rows is a subclass of UITableViewCell and is loaded from nib. As my rows contain dynamic content, I use layoutSubviews to reposition all subviews: - (void)layoutSubviews { [super layoutSubviews]; CGFloat initialHeight = titleLabel.bounds.size.height; CGSize constraintSize = CGSizeMake(titleLabel.bounds.size.width, MAXFLOAT); CGSize size = [titleLabel.text sizeWithFont:titleLabel.font constrainedToSize:constraintSize]; CGFloat delta = size.height - initialHeight; CGRect titleFrame = titleLabel.frame; titleFrame.size.height += delta; titleLabel.frame = titleFrame; locationLabel.frame = CGRectOffset(locationLabel.frame, 0, delta); dayLabel.frame = CGRectOffset(dayLabel.frame, 0, delta); timeLabel.frame = CGRectOffset(timeLabel.frame, 0, delta); } The problem is that I can't find a way to determine the height in table view delegate's tableView:heightForRowAtIndexPath: method. The trick is that I load cell from nib, so just after it's loaded titleLabel.bounds.size.width is 300 px (as in nib), not taking into account type of the device (iPhone/iPad) and current orientation, so it seems impossible to calculate the height without conditional checks for orientation and device type. Any ideas?

    Read the article

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