UITableViewCell. accessoryType problem

I have a custom table view cell which inherits from UITableViewCell. In its content view I have added a UISegmentedControl.
When I change the selection in the UISegmentedControl I modify the table view cell's accesstoryType.
Although this works (the appearance of the table view cell in the table changed to use the new accessory type), I have discovered that the table view it belongs appears to stop firing the tableView:accessoryButtonTappedForRowWithIndexPath: on the table view's UITableViewDelegate delegate.
My table view cell toggles the accessoryType between UITableViewCellAccessoryNone and UITableViewCellAccessoryDetailDisclosureButton.
Has anyone else noticed this? Am I going about this the wrong way?
Thanks for any help, Dave.

There are several ways you can find the address of the table view object from inside a cell method (e.g. see [http://discussions.apple.com/thread.jspa?messageID=9504961&#9504961]). But to test Andreas' suggestion, I would just add an ivar/property to your cell subclass. For example if the table view data source is a controller subclass named MyTableController:
@interface MyCellType : UITableViewCell {
UITableView *tableView;
@property (nonatomic, assign) UITableView *tableView;
@implementation MyTableController
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (cell == nil) {
cell.tableView = tableView
I have some other questions and suggestions for you as well (though I would definitely try Andreas' idea first)::
1) Just to check if I understand your original post, when the code in changedModeAction isn't commented out, are you getting taps in the delegate up until the time you first run changedModeAction?
2) Which accessory type is the default? I.e. before you first run changedModeAction: which type is there? If the default isn't UITableViewCellAccessoryDetailDisclosureButton, try making that the default (i.e. set that type in cellForRowAtIndexPath);
3) In the method you posted (repeated below), who is sender and who is self?
- (void) changedModeAction:(id)sender {
// User changed the alarm mode.
switch (modeSegmentedControl.selectedSegmentIndex)
case 0:
self.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
break;
default:
self.accessoryType=UITableViewCellAccessoryDetailNone;
break;
4) Are you tracking the type change in cellForRowAtIndexPath? Put a NSLog() in cellForRow.. and see if it runs after the switch.

Similar Messages

  • UITableViewCell initWithFrame:CGRectMake Autoresizing Problems..

    Hello...
    There are problems defining the Frame for my TableViewCell.. the documentation describes to approaches as mentioned (i've quoted them at the bottom), and I am implementing the first one - therfore, just adding views as subviews. It is looking like this - and is working more or less:
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
    UILabel * nickLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 12.0, 50.0, 20.0)] autorelease];
    nickLabel.text = [tempDict valueForKey:@"id"];
    nickLabel.font = [UIFont systemFontOfSize:12.0];
    nickLabel.textAlignment = UITextAlignmentRight;
    nickLabel.textColor = [UIColor blueColor];
    nickLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin |
    UIViewAutoresizingFlexibleHeight;
    [cell.contentView addSubview:nickLabel];
    the problem is, that as I am adding more and more subviews, I need more space for doing so. But it seems that my cellView is not "autoresizing" even if i define it with a special Rect like
    cell = [[[UITableViewCell alloc] initWithFrame:CGRect(0.0, 0.0, 400.0, 100.0) reuseIdentifier:MyIdentifier] autorelease];
    sure, this approach is not documented (the doc says use RectZero..) but i am just trying.. for example this Rect setting of my label looks like as if it would be in the third tableView Row.
    UILabel * nickLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 100.0, 50.0, 20.0)] autorelease];
    any ideas?
    +■You should add subviews to a cell’s content view when your content layout can be specified+
    +entirely with the appropriate autoresizing settings and when you don’t need to modify the default+
    +behavior of the cell.+
    +■ You should create a custom subclass when your content requires custom layout code or when+
    +you need to change the default behavior of the cell, such as in response to editing mode.+

    http://iphone.zcentric.com/2008/08/05/custom-uitableviewcell/ helped.
    +change. How do I increase the size of each cell?+
    +# mikezupan Says:+
    +August 25th, 2008 at 8:39 am+
    @Turbolag
    +the only way I have found to edit the height of a cell is doing it in the tableView.+
    +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {+
    +return 100.0; //returns floating point which will be used for a cell row height at specified row index+

  • Problem with text in detailTextLabel of UITableViewCell

    I have an odd problem when changing the detailTextLabel property of a UITextViewCell. If I change the label to an empty string, using something like:
    cell.detailTextLabel.text = @"";
    Then at a later point change the text to a different non-empty string, the string does not appear. I know that correct detail text label is being set to the non-empty string (I've compared memory addresses, and also, if I don't change the string to the empty string, the string changes and displays correctly).
    I've tried things like making sure that the text is black, etc, and have compared the size of the label when it works and when it doesn't (in both cases, it is zero). As far as I can tell, the text is actually set
    correctly, it seems to be a drawing issue. I'm not sure if this is a fairly common problem, but if anybody know how to fix it, or further things I could check, I'd be very grateful.

    m_userName wrote:
    I'm not sure what you mean by changing the corresponding text in the data source.
    I should have explained that better, since you might have assumed I meant the data source object. I was referring to the data structure used by tableView:cellForRowAtIndexPath: to load each cell. For instance, take a look at tableView:cellForRowAtIndexPath: in this example code I posted in one of your recent threads: [Re: Trouble tracking down EXCBADACCESS error|http://discussions.apple.com/thread.jspa?messageID=12436920&#12436920]. In that case the data for each cell is obtained from the tableDataSource array:
    // Set up the cell...
    NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
    cell.textLabel.text = [dictionary objectForKey:@"Title"];
    return cell;
    So what I meant in my last post is that whenever you change the data in a cell (the detailTextLabel in this case), you must also change the data which tableView:cellForRowAtIndexPath: will use when replacing that cell. Otherwise whatever change you made will be reversed as soon as that cell is replaced (which usually happens when the cell is scrolled out of view, then scrolled back into view, but can happen at other times as well).
    Here's an example of how to use [reloadRowsAtIndexPaths:withRowAnimation:|http://developer.apple.com/library/io s/documentation/UIKit/Reference/UITableViewClass/Reference/Reference.html#//appleref/doc/uid/TP40006943-CH3-SW40] to change the detail text label of one of the cells. Note that we don't need to find the cell and modify the label directly. We just change the data source for the target row then reload the cell for that row:
    // RootViewController.m
    #import "RootViewController.h"
    #define kDetailText @"Detail Text"
    @implementation RootViewController
    @synthesize data, tableDataSource;
    - (void)viewDidLoad
    [super viewDidLoad];
    level = [self.navigationController.viewControllers count];
    NSLog(@"%s: level=%d", _func_, level);
    if (level <= 1) {
    NSString *Path = [[NSBundle mainBundle] bundlePath];
    NSString *DataPath = [Path stringByAppendingPathComponent:@"data.plist"];
    NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile:DataPath];
    self.data = tempDict;
    [tempDict release];
    self.tableDataSource = [data objectForKey:@"Children"];
    self.navigationItem.title = [data objectForKey:@"Title"];
    else
    ; // tableDataSource and navigationItem.title were set by previous controller
    // NSLog(@"%s: self.tableView=%@", _func_, self.tableView);
    // make a nav bar button to toggle the detail text for row 0
    UIBarButtonItem *detailBBI = [[UIBarButtonItem alloc]
    initWithTitle:@"Detail" style:UIBarButtonItemStylePlain
    target:self action:@selector(toggleDetailTextForRow0)];
    self.navigationItem.rightBarButtonItem = detailBBI;
    [detailBBI release];
    // initialize the detail text
    detailText = kDetailText;
    - (void)toggleDetailTextForRow0 {
    if ([tableDataSource count]) {
    detailText = [detailText isEqualToString:@""] ? kDetailText : @"";
    // get index path for row 0 and reload that row
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
    NSArray *indexPathArray = [NSArray arrayWithObject:indexPath];
    [self.tableView reloadRowsAtIndexPaths:indexPathArray
    withRowAnimation:UITableViewRowAnimationNone];
    - (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    if (self.navigationController == nil) {
    NSLog(@"%s: *POPPED* level=%d", _func_, level);
    #pragma mark Table view methods
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
    // Customize the number of rows in the table view.
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [tableDataSource count];
    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView
    cellForRowAtIndexPath:(NSIndexPath *)indexPath
    static NSString *CellIdentifier = @"TableViewCell";
    UITableViewCell *cell = (UITableViewCell*)
    [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    // NSLog(@"%s: level=%d row=%d", _func_, level, indexPath.row);
    cell = [[UITableViewCell alloc]
    initWithStyle:UITableViewCellStyleValue1
    reuseIdentifier:CellIdentifier];
    // set the text label
    NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
    cell.textLabel.text = [dictionary objectForKey:@"Title"];
    // set the detail text label
    if (indexPath.row == 0)
    cell.detailTextLabel.text = detailText;
    else
    cell.detailTextLabel.text = kDetailText;
    return cell;
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    // NSLog(@"%s: tableDataSource=%@", _func_, self.tableDataSource);
    NSDictionary* dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
    // NSLog(@"%s: dictionary=%@", _func_, dictionary);
    NSArray* children = [dictionary objectForKey:@"Children"];
    // NSLog(@"%s: children=%@", _func_, children);
    if(children)
    // set up the next controller
    RootViewController* rootViewController = [[RootViewController alloc]
    initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
    rootViewController.navigationItem.title = [dictionary objectForKey:@"Title"];
    rootViewController.tableDataSource = children;
    // push the next controller onto the stack
    [self.navigationController pushViewController:rootViewController animated:YES];
    // NSLog(@"%s: stack=%@", _func_, self.navigationController.viewControllers);
    [rootViewController release];
    - (void)dealloc {
    NSLog(@"%s: level=%d", _func_, level);
    [tableDataSource release];
    [data release];
    [super dealloc];
    @end
    In the above, the data source for the text label is the tableDataSource array while the data source for the detail label text is just two hard-coded strings for the purpose of demonstration. The detailText ivar is the data source for the detail label in row 0, and the string at that ivar is changed in toggleDetailTextForRow0 whenever the Detail button in the nav bar is tapped. Also note that you can add animation to the label change by resetting the second arg of reloadRowsAtIndexPaths::
    - Ray

  • Problem with UITableViewCell, can´t add the same custom cell

    Hi,
    I have a table view which I populate the cells with a UITableView class that i wrote. This custom class has two labels and a image view. In the method cellForRowAtIndexPath, i use the following code:
    [cell addSubview:myTableViewCellClass];
    the first cell is ok, the cell displays my custom cell. But the second cell can´t display the same custom cell object. Is there something I can do to avoid this problem?
    I have another problem. When i scroll my table view very fast, the program crashes with the following message:
    [Session started at 2008-08-24 18:30:10 -0700.]
    Loading program into debugger…
    GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols >for
    "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
    warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
    warning: Unable to read symbols for "/System/Library/Frameworks>/CoreGraphics.framework/CoreGraphics" (file not
    found).
    warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
    Program loaded.
    sharedlibrary apply-load-rules all
    Attaching to program: `/Users/pitteri/Library/Application Support/iPhone
    Simulator/User/Applications/9F7BD517-CB1E-49C5-BD30-24831239120F/OndeEstou.app/O ndeEstou', process 11209.

    This is not the correct method for using custom table cells with a table. You need to create a custom cell class that extends UITableViewCell. This class should handle the layout and display for the content of a single cell.
    In your table view delegate's 'cellForRowAtIndexPath' method, you create or obtain an instance of your custom cell, configure the cell by setting the title or other properties appropriate for you custom cell, then return the cell. That's it.
    It appears, from your code, that you are trying to add the table view cell class to the cell. Maybe you mistyped. But don't call 'addSubview' on anything within the table view delegate.
    Have a look at the UICatalog example app. It has several custom table cells and shows both how to implement a custom cell, but also how to use it in a table.
    Enjoy.

  • Problem with objective-c troubleShooting

    Hi there,
    i'm all new to mac & iOS developement and am getting startet by working throught what appeared to be a great book "Einstieg in Objective-C 2.0 and Cocoa inkl iPhone programming".
    what im doing right now is creating an Weblog App for the iPhone by following stepBy step coding and interface instructions by this book.
    problem: everything seems to work just fine, i can compile and everything. but one funktion does not work which is creating a new article.
    the errorcode looks like that:
    +2011-01-25 14:59:28.775 WeblogClientTouch[12682:207] Fehler beim Anlegen eines neuen Artikels+
    and is produced by an NSLog:
    if (![managedObjectContext save:&error]) {
    NSLog(@"Fehler beim Anlegen eines neuen Artikels");
    so apparently the saving of a new entity 'article' does not work. here some code snippets that might help, first the function that creates a new article in which the error occurs:
    - (IBAction)neuerArtikel
    //erzeuge artikel
    NSEntityDescription *artikelDescription = [[fetchedResultsController fetchRequest]entity];
    NSManagedObject *newArtikel = [NSEntityDescription insertNewObjectForEntityForName:[artikelDescription name]
    inManagedObjectContext:managedObjectContext];
    //befülle artikel mit standardwerten
    [newArtikel setValue:NSLocalizedString(@"Neuer Artikel", nil)
    forKey:@"titel"];
    [newArtikel setValue:[NSDate date] forKey:@"datum"];
    [newArtikel setValue:@"Markus" forKey:@"autor"];
    //speichere artikel
    NSError *error;
    if (![managedObjectContext save:&error]) {
    NSLog(@"Fehler beim Anlegen eines neuen Artikels");
    //Tableview aktualisieren
    [self.tableView reloadData];
    in my datamodel i have only one entity named "Artikel" with the attributes: autor, titel, datum, inhalt.
    i would be very glad about some tips, because i've been trying to solve the problem for nearly 3 hours now and i dont think it can be that tricky..
    Message was edited by: sfluecki
    Message was edited by: sfluecki

    allRight.
    i got it working so far that there's no more errors.
    --> i can now klick on 'new article' without any errors, but my tableView does not show the new allocated articles
    --> after i restart the app (rebuild, reRun in simulator) the previously added articles are showing in the tableView.
    --> somehow my tableView does just update itself whilst starting the app.
    in the end of the 'addNewArticle' function i have the following:
    [self.tableView reloadData];
    the tableView itself is defined by the following:
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    NSArray *sections = [fetchedResultsController sections];
    NSUInteger count = 0;
    if ([sections count]) {
    id <NSFetchedResultsSectionInfo> sectionInfo = [sections objectAtIndex:section];
    count = [sectionInfo numberOfObjects];
    return count;
    and
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    static NSString *CellIdentifier = @"Cell";
    //Zelle aus dem Cache holen oder erzeugen wenn nicht orhanden
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle
    reuseIdentifier:CellIdentifier] autorelease];
    NSManagedObject *artikel = [fetchedResultsController objectAtIndexPath:indexPath];
    //Titel als haupttext der zelle
    cell.textLabel.text= [artikel valueForKey:@"titel"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    //Autor und Name als Detailtext der Zelle
    NSDateFormatter *dateFormatter = [NSDateFormatter new];
    [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
    NSString *dateString = [dateFormatter stringFromDate:[artikel valueForKey:@"datum"]];
    cell.detailTextLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ am %@",nil), [artikel valueForKey:@"autor"], dateString];
    [dateFormatter release];
    return cell;
    whilst the function fetchedResultsController looks like this.
    - (NSFetchedResultsController *)fetchedResultsController
    if (fetchedResultsController != nil)
    return fetchedResultsController;
    //FetchRequest initialisieren
    NSFetchRequest *fetchedRequest = [NSFetchRequest new];
    NSEntityDescription *artikelDescription = [NSEntityDescription entityForName:@"Artikel"
    inManagedObjectContext:managedObjectContext];
    [fetchedRequest setEntity:artikelDescription];
    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"datum" ascending:NO];
    NSArray *sortDescriptors = [[NSArray alloc]initWithObjects:sortDescriptor, nil];
    [fetchedRequest setSortDescriptors:sortDescriptors];
    //FetchedResultsController initialisieren
    fetchedResultsController = [[NSFetchedResultsController alloc]initWithFetchRequest:fetchedRequest
    managedObjectContext:managedObjectContext
    sectionNameKeyPath:nil
    cacheName:@"Overview" ];
    fetchedResultsController.delegate = self;
    //aufräumen
    [fetchedRequest release];
    [sortDescriptor release];
    [sortDescriptors release];
    return fetchedResultsController;
    i'm sorry to bother you with that lot of code.. but i'm stuck here since now 8h,
    and wouldnt probably be any step further without your help in the first place,
    so thanks a lot for the first inputs =)

  • Default UITableViewCell text label background color

    I need a table view cell that just has simple text but with custom backgroundView images when not selected vs. selected. I'm too lazy to implement a custom cell, so I was using the regulation UITableViewCell, setting the backgroundView and backgroundSelectedView. The problem is for non-white backgroundView, when the cell is not selected, the text has a white box around it (the background color of the label containing the text, I assume), which looks horrible. When the cell is selected, the default UITableViewCell implementation takes care of changing the text color to white and text label background to clearColor and the custom backgroundSelectedView shows through beautifully. Is there a reason why the text label shouldn't just have a clear background color ALL THE TIME?? If the UITableViewCell is not customized for backgroundView, i.e., the cell background is white, the clear colored text label is no different from a white colored text label. If the backgroundViews are customized to non-white, a clear text label won't be in the way of the backgroundView showing through.
    Does this sound like a good feature request?
    How does one submit requests or bug reports for iPhone SDK anyways??
    Thanks.

    fitzyjoe wrote:
    I am having this exact same problem right now. Did you have to subclass UITableViewCell to fix it?
    I had the same problem and subclassed UITableViewCell to solve it. I set the backgroundView and selectedBackgroundView to UIView instances I wanted to use and then implemented setSelected:animated: in my subclass.
    {code:}
    -(void)setSelected:(BOOL)selected animated: (BOOL)animated {
    [super setSelected: selected animated: animated];
    for (UIView *view in self.contentView.subviews) {
    view.backgroundColor = [UIColor clearColor];
    {code}
    Bit bruteforce and as Apple suggests this will impact table performance, but the tables I work with aren't that big and it works well so far.
    It'd be nice if UITableViewCell honored backgroundView like it does selectedBackgroundView, i.e. when the backgroundView property is set keep the cell contents transparent.

  • NSOperation problem

    I'm trying to load images from url's and place one image per row in my tableview. Here's the code that I have so far which comes close to working, but not quite. The problem is that the images in the table rows keep updating to the latest one downloaded. Once the image in row 0 has been set, it shouldn't change when the image is downloaded for row 1. I can't count on knowing beforehand how many rows and images I'm going to handle.
    Thanks.
    -Phil
    .h
    @interface OSCouponsVC : UIViewController <ADBannerViewDelegate,
    CLLocationManagerDelegate,
    UITableViewDelegate,
    UITableViewDataSource>
    IBOutlet UITableView* couponsTableView;
    NSData* coasterData;
    IBOutlet UITableViewCell* dynCell;
    NSArray* coupons;
    @property (nonatomic, retain) UITableView* couponsTableView;
    @property (nonatomic, retain) NSData* coasterData;
    @property (nonatomic, retain) UITableViewCell* dynCell;
    @property (nonatomic, retain) NSArray* coupons;
    @end
    .m
    - (void)viewDidLoad {
    [super viewDidLoad];
    self.couponsTableView.delegate = self;
    self.couponsTableView.dataSource = self;
    self.coasterData = [[NSData alloc] init];
    - (void)loadCoasterData:(NSURL*)url {
    NSOperationQueue* queue = [[NSOperationQueue alloc] init];
    NSInvocationOperation* operation = [[NSInvocationOperation alloc] initWithTarget:self
    selector:@selector(loadDataWithOperation:)
    object:url];
    [queue addOperation:operation];
    [operation release];
    - (void)loadDataWithOperation:(NSURL*)url {
    NSData* imageData = [NSData dataWithContentsOfURL:url];
    self.coasterData = imageData;
    [self.couponsTableView performSelectorOnMainThread:@selector(reloadData)
    withObject:nil
    waitUntilDone:YES];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString* myID = @"CouponsCellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:myID];
    if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CouponsDynCell" owner:self options:nil];
    cell = self.dynCell;
    self.dynCell = nil;
    UIImageView* tempImageView;
    //// COASTER ////
    tempImageView = (UIImageView*)[cell viewWithTag:1];
    NSURL* theURL = [NSURL URLWithString:[[self.coupons objectAtIndex:(couponCategory * 3) + indexPath.row] objectForKey:@"coaster_url"]];
    [self loadCoasterData:theURL];
    tempImageView.image = [UIImage imageWithData:self.coasterData];
    return cell;

    Another code example - here the main thread actually counts to 1000 first, then the op1, and then op2. This can of course be a coincidence, but I've run it a few times
    require 'osx/cocoa'
    include OSX
    class MyOp < NSOperation
    def main
    i = 0
    (1..1000).each{|i| puts "Ping #{i} from op #{self.inspect}"}
    end
    end
    class AppDelegate < NSObject
    def applicationDidFinishLaunching(aNotification)
    queue = NSOperationQueue.new
    queue.addOperation(MyOp.new)
    queue.addOperation(MyOp.new)
    (1..1000).each{|i| puts "Ping #{i} from app #{self.inspect}"}
    end
    end
    NSApplication.sharedApplication
    NSApp.setDelegate(AppDelegate.alloc.init)
    NSApp.run

  • UIWebView in UITableViewCell rotation issues

    I've been trying for a while now to get a UIWebView inside a UITableViewCell working correctly, and although it's almost correct, I'm getting issues with specifc HTML code tags.
    I want to have UITableViewCells, with each cell containing a single UIWebView. Each cell can have a different height, and it should be sized such that the entire UIWebView is exactly visible. On rotation, it should resize the views so the content still fits exactly.
    I'm currently using -[UIWebView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"]; to get the required height, after setting the frame to the correct width, but a tiny height (1 pixel in my case).
    This works correctly, up until rotation. Then I'm getting incorrect values if the HTML code in the webview contains a
    or for example.
    I've made a minimal example at http://www.daedalus-development.net/TestUIWebViewRotate.zip which contains the problem.
    If anyone has any ideas about this specific issue, or about the way I'm handling the UIWebView in general then I'd be glad to hear about.
    Kind regards,
    Rick

    Set up the UIWebView with the desired width and a height of 1.0. Make your UITableViewController subclass the delegate for the UIWebView. Then use the following code to resize the UIWebView and call reloadData on the UITableView.
    In your tableView:heightForRowAtIndexPath: implementation, calculate the height of the cell based on webView.frame.size.height. The UITableView will call this method again after you call reloadData, so it will pick up the new height.
    - (void) webViewDidFinishLoad:(UIWebView *)sender {
    [self performSelector:@selector(calculateWebViewSize) withObject:nil afterDelay:0.1];
    - (void) calculateWebViewSize {
    [webView sizeToFit];
    [self.tableView reloadData];
    Message was edited by: Jasper Bryant-Greene

  • Adding custom buttons to UITableViewCell - iphone

    Hello all.
    I have a question for the iphone developers,
    I want to add several buttons to a UITableViewCell in a grouped TableView I have set up.
    The requirements are this:
    1) Place two buttons together in a view.
    2) Add up to 4 of these views to a UITableViewCell.
    It would look like this
    row1: O O O O
    row2: O O O O
    Where each O is a view containing two buttons on top of each other. These buttons, when clicked, take you to a new View.
    Anyway, I hope I can get some help, I'm quite new to developing for the iphone.

    dsan4444 wrote:
    I notice that IBAction methods have a sender parameter. Is this the UIButton object that gets pressed?
    Yes. In the example, the sender is whichever button sent the 'upperAction' or 'lowerAction' message. There are two separate action methods because I took your description to mean that "upper" buttons would have a different function from "lower" buttons. But you could certainly connect all the buttons to one action method if desired.
    Note the connection between button and action method is made by [addTarget:action:forControlEvents:|http://developer.apple.com/iphone/library/d ocumentation/UIKit/Reference/UIControlClass/Reference/Reference.html#//appleref/doc/uid/TP40006779-RH2-SW4], which UIButton inherits from UIControl. This method makes an event-action connection just as if you had dragged from the button to the controller in IB. Of course doing this in code allows us to choose the target object and the action method dynamically.
    it would nice if I could make a subclass of UIButton and then add info fields to that so I can easily access them without matching up tags.
    That would be a poor decision. You would be duplicating the information stored in the data source, not a good reason to buy-in to the possible problems of a custom subclass. In fact, redundant data storage is usually poor design regardless of the extra effort. In other words, subclassing to duplicate the data model would be like paying to acquire an illness of some kind.
    The way to do what you want is to use the sender's tag as a data source key. I think that was your first idea, which is why I saved it for last:
    So with this implementation do I know what data to display by labeling the info with the same tag as the buttons?
    Yes. Except you don't need to add any extra labels to the data source, and you can use any system you want to choose the tag numbers, just as long as you know the system (hint: an explanation of the numbering system should be added with inline comments, not just in an external document).
    In the example code the "pair" number is in the hundreds place and the button number in the ones place. So tag 302 means "pair 3 button 2". In this case there are only two button positions in each set, "upper" (1) and "lower" (2). But the numbering system is extensible. So if you ever want a triple instead of a pair in each set, you shouldn't need to change much code.
    So given the tag numbering system, how do we retrieve the additional info associated with each button? Well firstly, the button pair number is the same as the position of the matching dictionary in the array (which would normally reflect the order of the xml data stream). Here's an example that extends the previous action methods. Note that as the example gets closer to a real app, we need to add an ivar to save the data source array:
    // DsanViewController.h
    @interface DsanViewController : UIViewController {
    NSMutableArray *dataArray;
    @property (nonatomic, retain) NSMutableArray *dataArray;
    @end
    // DsanViewController.m
    #import "DsanViewController.h"
    @implementation DsanViewController
    @synthesize dataArray;
    - (void)dealloc {
    [super dealloc];
    [dataArray release];
    - (void)upperAction:(id)sender {
    UIButton *button = sender;
    int tag = button.tag;
    int index = tag / 100 - 1;
    NSDictionary *dict = [dataArray objectAtIndex:index];
    // if we didn't have separate action methods, we would
    // know upper from lower like this:
    // BOOL is_upper = tag % 100 ? NO : YES;
    // but in the current case, we already know sender is
    // an upper button
    NSString *title = [dict objectForKey:@"UpperTitle"];
    NSString *info = [dict objectForKey:@"UpperInfo"];
    NSLog(@"upperAction: tag=%d title=%@ info=%@", tag, title, info);
    - (void)lowerAction:(id)sender {
    UIButton *button = sender;
    int tag = button.tag;
    int index = tag / 100 - 1;
    NSDictionary *dict = [dataArray objectAtIndex:index];
    // we already know sender is a lower button
    NSString *title = [dict objectForKey:@"LowerTitle"];
    NSString *info = [dict objectForKey:@"LowerInfo"];
    NSLog(@"lowerAction: tag=%d title=%@ info=%@", tag, title, info);
    - (void)viewDidLoad {
    [super viewDidLoad];
    // assume the xml data will be stored in an array of dictionaries
    NSMutableArray *array = [NSMutableArray arrayWithCapacity:4];
    // retain the array and save its address in an ivar
    self.dataArray = array;
    // same as previous example from here
    // - in the real app, the array would be loaded from the xml parser at this point
    When the remaining, previously posted viewDidLoad code is added after the last comment, the above is working, tested code, based on your original requirement description (except for an additional subview for each pair of buttons). Just paste directly from the forum into a new View-based App template. Nothing need be added to the xib, since all the buttons and connections are created dynamically, in code. I think you might benefit by building a testbed from the example code. That will give you a baseline for the UI, and you can use it to experiment with different button placements, etc.
    Some books and classroom instructors teach "top-down" design by insisting on a complete functional design before writing the first line of code. This rarely works very well if you're new to the language, the API and the platform (especially if the language is Obj-C, the API is Cocoa and the platform is iPhone!!) In that case the best laid plans of mice and men can get hopelessly bogged down, first in syntax errors, then in runtime errors, and finally when the entire architecture proves incompatible with the support in the system. I prefer top-down-bottom-up-top-down-etc., so the top-down design is informed by what I actually know how to do.
    If you build a testbed from the example code, I'm hoping that will save you from some of the more common gotchas that can keep your functional, top level design from becoming a reality.
    - Ray

  • Problem responding to view being popped from navigation controller

    I have a detail view controller which is pushed onto the application's navigation controller stack by a given parent controller. The user is able to select table values in the detail controller, which should update the parent controller when, and only when, the detail view is popped and the parent view is made visible again.
    Is there a way to do this? I couldn't see any appropriate methods in UIViewController which would be called when the child view is popped. I've tried to make the parent controller conform the UINavigationControllerDelegate protocol and provided an implementation for willShowViewController method, but this method doesn't seem to get called when the view is displayed.
    I'm not sure if I'm going about it the right way trying to implement the UINavigationControllerDelegate and there is a bug with my implementation, or there are better ways to go to implement this functionality, such as using a modal controller, etc.

    m_userName wrote:
    The user is able to select table values in the detail controller, which should update the parent controller when, and only when, the detail view is popped and the parent view is made visible again.
    I don't understand why you require the update to be made only when the detail controller is popped, since during the time the detail controller is on top of the stack, the controller underneath isn't visible. It's common practice to pass data to the previous controller any time before the top controller is popped. Note that there's only a short interval between the time the top controller is removed from the stack and the time it's deallocated (unless you've retained that controller elsewhere, which should be avoided for best memory management).
    That said, [viewDidDisappear:|http://developer.apple.com/library/ios/documentation/UIKit/R eference/UIViewControllerClass/Reference/Reference.html#//appleref/doc/uid/TP40006926-CH3-SW20] is called during that interval, so I think it would be a good choice for the requirement you described:
    - (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    if (self.navigationController == nil) {
    NSLog(@"%s: *POPPED* level=%d", _func_, level);
    // pass the data here
    The test for a nil navigationController pointer tells us whether the controller is actually off the stack when viewDidDisappear: runs. This is useful in case an instance of this controller class ever pushes another controller on top of it, since viewDidDisappear: will run in that situation as well. But in that case the controller doing the pushing remains on the stack, so its navigationController property won't be nil. If that property is nil when viewDidDisappear: runs, we know self has just been popped.
    You can also find the above example in [Problem with text in detailTextLabel of UITableViewCell |http://discussions.apple.com/message.jspa?messageID=12495708#12495708], so if you build the code in that thread you can see how things work together.
    - Ray

  • How to manage the uitableviewcell after being scrolled?

    Hi all.
    I manipulated the cell of the table view to be a custom one, which will be expanded(from height=50 to height=100) on selection and will be srinked to original(from height=100 to height=50) on second click or deselction. Now my problem is that i am selecting a row and without deselecting it or without clicking it for second time if i am scrolling the table ,the cell should reload to the original(height=50) srinked one. Here the view is reloading but the height for that row is not srinking(still height for that row remains to be 100). Can anyone have tried like this? Plz help me to sort out the problem.
    Tanks in advance.
    Satya.

    Well sorry for late responsse, here is the code:_
    @interface HomeControl : UIViewController<UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource >
              IBOutlet UITableView *newsTable;
              NSArray *dataArray;
              NSMutableArray *selectedRowArray,*clickedCountArray;
              CGRect frame;
    @property (nonatomic,retain) UITableView *newsTable;
    @property (nonatomic,retain) NSArray *dataArray;
    @property (nonatomic,retain) NSMutableArray *selectedRowArray,*clickedCountArray;
    @end
    @implementation HomeControl
    @synthesize newsTable,dataArray,selectedRowArray,clickedCountArray;
    - (void)viewDidLoad
              //table view section
                        NSDictionary *row1=[[NSDictionary alloc] initWithObjectsAndKeys:@"News",@"newsCatagory",@"News Title",@"newsTitle",nil],*row2=[[NSDictionary alloc] initWithObjectsAndKeys:@"News'it",@"newsCatagory",@"News Title",@"newsTitle",nil],*row3=[[NSDictionary alloc] initWithObjectsAndKeys:@"News",@"newsCatagory",@"News Title",@"newsTitle",nil],*row4=[[NSDictionary alloc] initWithObjectsAndKeys:@"Fashion",@"newsCatagory",@"Good Deal Title",@"newsTitle",nil],*row5=[[NSDictionary alloc] initWithObjectsAndKeys:@"News",@"newsCatagory",@"News Title",@"newsTitle",nil];
                        NSArray *a=[[NSArray alloc] initWithObjects:row1,row2,row3,row4,row5,nil];
                        self.dataArray=a;
                        [row1 release];[row2 release];[row3 release];[row4 release];[row5 release];[a release];
                        selectedRowArray=[[NSMutableArray alloc] initWithCapacity:dataArray.count];
                        clickedCountArray=[[NSMutableArray alloc] initWithCapacity:dataArray.count];
                        for(int i=0; i<[dataArray count]; i++)
                                  [selectedRowArray addObject:[NSNumber numberWithInt:0]];
                                  [clickedCountArray addObject:[NSNumber numberWithInt:0]];
    - (void)viewDidUnload
              // Release any retained subviews of the main view.
              // e.g. self.myOutlet = nil;
              self.newsTable=nil; self.selectedRowArray=nil;          self.clickedCountArray=nil;
              self.dataArray=nil;
              [super viewDidUnload];
    - (void)dealloc
              [newsTable release]; [selectedRowArray release]; [clickedCountArray release];
              [dataArray release];
        [super dealloc];
    #pragma mark Custom Methods
    -(void)cellWithDataInTableForCell:(TableDataCellControl*)tCell withIndexPath:(NSIndexPath*)ip
              NSUInteger r=[ip row];
              NSDictionary *rowdata=[self.dataArray objectAtIndex:r];
              tCell.newsL.text=[rowdata objectForKey:@"newsCatagory"];
              tCell.title.text=[rowdata objectForKey:@"newsTitle"];
              if(tCell.newsL.text==@"Fashion")
                        tCell.rowImage.image=[UIImage imageNamed:@"orange.png"];
              else if(tCell.newsL.text==@"News'it")
                        tCell.rowImage.image=[UIImage imageNamed:@"IT-Icon.png"];
                        tCell.rowImage.backgroundColor=[UIColor clearColor];
              else
                        tCell.rowImage.image=nil;
              NSDateFormatter *formatter=[[NSDateFormatter alloc] init];
              [formatter setDateFormat:@"dd-MM-yyyy HH:mm"];
              tCell.timeL.text=[formatter stringFromDate:[NSDate date]];
              [formatter release];
    -(void)accessViewForCell:(TableDataCellControl*)tCell
              UILabel *l=[[UILabel alloc] initWithFrame:CGRectMake(0,0,10,12)];
              l.textAlignment=UITextAlignmentCenter;
              l.backgroundColor=[UIColor clearColor];
              l.textColor=[UIColor blueColor];
              if(tCell.selectedRow==0) l.text=@">";
              else l.text=@"<";
              tCell.accessoryView=l;
              tCell.accessoryView.userInteractionEnabled=YES;
              [l release];
    #pragma mark Table DataSource Methods
    -(NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)s
              return [self.dataArray count];
    -(NSString *)tableView:(UITableView *)tv titleForHeaderInSection:(NSInteger)s
              if(s==0)
                        return [NSString stringWithString:@"Actuallite"];
              else
                        return nil;
    -(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)ip
              static NSString *cid=@"CID";
              TableDataCellControl *tCell=(TableDataCellControl *)[tv dequeueReusableCellWithIdentifier:cid];
              if([[clickedCountArray objectAtIndex:ip.row] intValue]%2==0)
                        if(tCell==nil)
                                  NSArray *cellNib=[[NSBundle mainBundle] loadNibNamed:@"TableCell" owner:self options:nil];
                                  for(id ob in cellNib)
                                            if([ob isKindOfClass:[TableDataCellControl class]])
                                                      tCell=(TableDataCellControl *)ob;
                        tCell.selectedRow=[[selectedRowArray objectAtIndex:ip.row] intValue];
                        tCell.rowClicked=[[clickedCountArray objectAtIndex:ip.row] intValue];
                        [self cellWithDataInTableForCell:tCell withIndexPath:ip];
                        [self accessViewForCell:tCell];
              else
                        if(tCell==nil)
                                  NSArray *cellNib=[[NSBundle mainBundle] loadNibNamed:@"TableCellExtended" owner:self options:nil];
                                  for(id ob in cellNib)
                                            if([ob isKindOfClass:[TableDataCellControl class]])
                                                      tCell=(TableDataCellControl *)ob;
                        tCell.selectedRow=[[selectedRowArray objectAtIndex:ip.row] intValue];
                        tCell.rowClicked=[[clickedCountArray objectAtIndex:ip.row] intValue];
                        [self cellWithDataInTableForCell:tCell withIndexPath:ip];
                        [self accessViewForCell:tCell];
              return tCell;
    -(void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)ip
              TableDataCellControl *tCell=(TableDataCellControl *)[tv cellForRowAtIndexPath:ip],*newCell;
              tCell.rowClicked+=1;
              [clickedCountArray replaceObjectAtIndex:ip.row withObject:[NSNumber numberWithInt:tCell.rowClicked]];
              if(tCell.selectedRow==0)
                        tCell.selectedRow=1;
                        [selectedRowArray replaceObjectAtIndex:ip.row withObject:[NSNumber numberWithInt:tCell.selectedRow]];
              else
                        tCell.selectedRow=0;
                        [selectedRowArray replaceObjectAtIndex:ip.row withObject:[NSNumber numberWithInt:tCell.selectedRow]];
              [tv reloadRowsAtIndexPaths:[NSArray arrayWithObject:ip] withRowAnimation:UITableViewRowAnimationFade];
              tCell=(TableDataCellControl*)[tv cellForRowAtIndexPath:ip];
              if(tCell!=nil)
                        for(id ob in tCell.contentView.subviews)
                                  [ob removeFromSuperview];
              NSArray *cellNib=[[NSBundle mainBundle] loadNibNamed:@"TableCellExtended" owner:self options:nil];
              for(id ob in cellNib)
                        if([ob isKindOfClass:[TableDataCellControl class]])
                                  newCell=(TableDataCellControl *)ob;
              [self cellWithDataInTableForCell:newCell withIndexPath:ip];
              //[self accessViewForCell:tCell];
              [tCell.contentView addSubview:newCell.contentView];
              if((tCell.selectedRow==0)&&(tCell.rowClicked%2==0))
                        [self tableView:tv didDeselectRowAtIndexPath:ip];
    -(void)tableView:(UITableView *)tv didDeselectRowAtIndexPath:(NSIndexPath *)ip
              [clickedCountArray replaceObjectAtIndex:ip.row withObject:[NSNumber numberWithInt:0]];
              [selectedRowArray replaceObjectAtIndex:ip.row withObject:[NSNumber numberWithInt:0]];
              int c,s;
              c=[[clickedCountArray objectAtIndex:ip.row] intValue];s=[[selectedRowArray objectAtIndex:ip.row] intValue];
              [tv reloadRowsAtIndexPaths:[NSArray arrayWithObject:ip] withRowAnimation:UITableViewRowAnimationFade];
              TableDataCellControl *tCell=(TableDataCellControl *)[tv cellForRowAtIndexPath:ip],*newCell;
              if(tCell!=nil)
                        for(id ob in tCell.contentView.subviews)
                                  [ob removeFromSuperview];
              NSArray *cellNib=[[NSBundle mainBundle] loadNibNamed:@"TableCell" owner:self options:nil];
              for(id ob in cellNib)
                        if([ob isKindOfClass:[TableDataCellControl class]])
                                  newCell=(TableDataCellControl *)ob;
              [self cellWithDataInTableForCell:newCell withIndexPath:ip];
              //[self accessViewForCell:tCell];
              [tCell.contentView addSubview:newCell.contentView];
    -(CGFloat)tableView:(UITableView *)tv heightForRowAtIndexPath:(NSIndexPath *)ip
              int cliked=[[clickedCountArray objectAtIndex:ip.row] intValue],selection=[[selectedRowArray objectAtIndex:ip.row] intValue];
              int check=(cliked%2==0)&&(selection==0)?0:1;
              switch (check)
                        case 0:
                                  return 49;
                                  break;
                        case 1:
                                  return 100;
                                  break;
                        default:
                                  return 49;
                                  break;
    @end

  • UITableViewCell and the Interface Builder

    I'm trying to use the Interface Builder to create a UITableViewCell but am having problems.
    I can create the UITableViewClass in my .xib file, connect the reference outlet and reuseIdentifier using the inspector. The problems occurs when I try and render the cell with this method...
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    Since the interface builder creates the TableViewCell automatically, I should be able to call...
    UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"priceCell"] autorelease];
    ..from inside the tableView:cellForRowAtIndexPath method and get that cell instance. But none of changes (Color, accessory view, etc...) I made to the table view come through.
    Has anyone got UITableViewCells created in the interface builder to work?

    Just an update to inform people of some of my findings.
    I had originally, before gkstuart's post, had added a UITableViewCell instance as a child of my view in IB. I then tried to use the cell via an IBOutlet in the UITableView in my view. This is when I was getting a completely blank screen when running my application. I then adopted gkstuart's idea and created a cell factory class, but without thinking, I used the same cell instance on each call to my 'newCell' method. Once I updated the 'newCell' method to load the nib file on each call to 'newCell' everything seems to work fine. As a note, the nib file loaded by 'newCell' is a simple nib file containing only my custom cell definition. It does not contain any views. Gkstuart's method of loading custom cells is unfortunate, because you can't seem to use the reusable cell theory when working with cells defined in IB. This is obviously something that needs work on Apple's side.
    As a test, I removed my custom cell definition from my original view nib. I then added a new top level instance of UITableViewCell, by dragging the UITableViewCell item to the window with the File Owner icon. After updating the custom cell definition with the appropriate class and outlets, I tried my original method again. I no longer get a completely blank screen, but it still doesn't work right. I now get a single cell in my table view, which happens to be the last cell in the list. When looking at it with the debugger, dequeueReusableCell never returns my cell instance so I am reusing and returning the same cell for each call to 'cellAtIndexPath'. I tried to manually call the cells 'prepareForReuse' method but this didn't seem to have any affect.
    So at this point, I am going to continue with the cell factory methodology until Apple either fixes the current problem or informs people on the proper way to use IB with custom UITableViewCell's.
    As a side note, I am going to start blogging about my experiences with the iPhone SDK over at iphonesdktrialsandtribulations.blogger.com.

  • Reuse the UITextView inside UITableViewCell

    Developers,
                I have added uitextviews as a subviews in uitableviewcell. I have about 4 columns and 30 rows in custom cell. Now the problem is that i have to alloc everytime new uitextview , thats why scrolling of tableview have become very slow, cells take so much time to load.
               Can anyone tell me how can i alloc my textview only once and reuse that for other cells also.
                                                                                                                                 Thanks.

    yes. I am using table cell instance. But i also want to reuse the textview which is the subview in the cell. Since there are dynamic number of columns ,sometimes 2 or 3 maybe 4, an i am filling the table row wise. First 3 starting elements in first row.then other 3 uiviews in second row. I used custom cell but while filling the third uivew in the row the first two are overlapped by the third one. Please tell me how can reuse the cell as well as the subview which is uiview..

  • Define selected UIImageView inside UITableViewCell

    Hello all.
    I have my custom MyTableViewCell : UITableViewCell. Inside this cell I have three UIImageViews. I.e. redView, greenView and blueView.
    What I need to do is to handle what view has been touched and print this info into console.
    Please help me to solve this issue.
    Thank you in advance.

    Hello Ray!
    Thank you for your reply. I tried to implement #3 approach but got failed. The problem is that button touch event is not fired and I can't figure out why. Please see my code below.
    I have custom controller for my table
    @interface SummaryViewController : UIViewController <UIScrollViewDelegate, UITextViewDelegate,
    UITableViewDelegate, UITableViewDataSource> {
    UITableView *myTableView;
    @property (nonatomic, retain) UITableView *myTableView;
    -(void)btnClick;
    @end
    And I add button in cellForRowAtIndexPath event of this controller:
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSInteger row = [indexPath row];
    UITableViewCell *cell = [myTableView dequeueReusableCellWithIdentifier:kNewsItemTableViewOffsetCell_ID];
    if (cell == nil) {
    cell = [[[NewsItemTableViewCell alloc] initWithFrame:CGRectZero
    reuseIdentifier:kNewsItemTableViewOffsetCell_ID] autorelease];
    // we are creating a new cell, setup its attributes
    if (row == 0) {
    //some business logic
    } else {
    UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(85, 10, 44, 34)];
    [button setBackgroundImage:[UIImage imageNamed:@"defaultTab.png"] forState:UIControlStateNormal];
    [button setTitle:@"Okay" forState: UIControlStateHighlighted];
    [button setTitle:@"Okay" forState: UIControlStateNormal];
    [button addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [((NewsItemTableViewCell *)cell).adContactsView addSubview:button];
    return cell;
    And finally I have button event handler in this controller:
    -(void)btnClick {
    NSLog(@"btnClick");
    My problem is that btnClick is not fired. But fired another delegate method didSelectRowAtIndexPath of UITableView.
    What am I doing wrong?
    Thanks.

  • Change UIbutton color inside UITableViewCell

    I have a simple problem ... but its turning into a very difficult problem .. i have a button inside uitableviewcell and want to change its color through code .... i could aceive it by changing its background image. But its kinna hazy ... its not the solid color ... and when i use [cell.button setBackgroundColor:[UIcolor redColor]] ... the button color does not change ...
    any help appreciated
    thanks

    Thanks for the fast answere.
    Unfortunately there is no effect when I include
    buttonName.backgroundColor = UIColor redColor;
    In my application I have a NSTimer which calls every 2 sec. a method which should change the color of the button. I would be also happy if the display blinks red and normal...

Maybe you are looking for

  • Satellite M60-164 need AC Adapter

    I have a Satellite M60-164. I tried to purchase a replacement AC Adapter. I sent the part number to my supplier and they tell me that it is discontinued. Anyone know an equivalent compatible adapter for Satellite M60-164.......thanks in advance for y

  • How can i target a movie of which i set the name based on a variable?

    Hi. I have the attached code: And i want to target the imgHolder ; that i have just created through the while function. I mean I attach a movieclip from the library to which I give a name composed from "imgHolder"+i where i is the number of the node

  • Syncing safari tabs across multiple macs

    I have a Mac Mini as my primary mac and a MBA as my "leisure" Mac. I thought with syncing that all my Safari tabs would be the same in both, like is done well with Mail, Contacts, and Calendar. However, I've just changed my Mini Safari tabs, and I we

  • Dump error: Dynpro does not exist while in transaction me31K

    HI, I am getting dump while creating the Contract in ME31K. hort text    Dynpro does not exist hat happened?    Error in the ABAP Application Program    The current ABAP program "SAPLXM06" had to be terminated because it has    come across a statemen

  • Install wildcard SSL on Cisco Prime Infrastructure 1.4

    I'm trying to install a wildcard SSL on a Cisco Prime Infrastrucure 1.4. I've manage to install this certificate on the Cisco 5508 WLC, however not so much success with the Cisco Prime. There are alot of documentation regarding the installtion of CSR