Search Results

Search found 1385 results on 56 pages for 'uitableview'.

Page 18/56 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • iphone dev - how to catch exception 'NSRangeException'

    - by Brian
    In my app I try to scroll a UITableView to the top once after I updated the content of the table. However, under some circumstance, my table is EMPTY. So I got the following exception: Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: row (0) beyond bounds (0) for section (0).' how can I catch this exception? I tried NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; if (indexPath != nil) { [EventTable scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; } but it doesn't catch the exception because indexPath is not nil.

    Read the article

  • Error when passing data between views

    - by Kristoffer Bilek
    I'm using a plist (array of dictionaries) to populate a tableview. Now, when a cell i pressed, I want to pass the reprecented dictionary to the detail view with a segue. It's working properly to fill the tableview, but how do I send the same value to the detail view? This is my try: #import "WinesViewController.h" #import "WineObject.h" #import "WineCell.h" #import "WinesDetailViewController.h" @interface WinesViewController () @end @implementation WinesViewController - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { [super viewDidUnload]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } #pragma mark - Table view data source - (void)viewWillAppear:(BOOL)animated { wine = [[WineObject alloc] initWithLibraryName:@"Wine"]; self.title = @"Vinene"; [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [wine libraryCount]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"wineCell"; WineCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // Configure the cell... cell.nameLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Name"]; cell.districtLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"District"]; cell.countryLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Country"]; cell.bottleImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Image"]]; cell.flagImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Flag"]]; cell.fyldeImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Fylde"]]; cell.friskhetImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Friskhet"]]; cell.garvesyreImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Garvesyre"]]; return cell; } #pragma mark - Table view delegate - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"DetailSegue"]) { NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow]; WinesDetailViewController *winesdetailViewController = [segue destinationViewController]; //Here comes the error line: winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:@"Name"]; } } I get one error for: winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:@"Name"]; Use of undeclaired identifier: indexPath. did you mean NSIndexPath? I think I've missed something important here..

    Read the article

  • iOS UITableViewCell UIImageView setting on different conditions

    - by chis54
    I have an app that has a UITableView and in my Cells I have UIImageViews and UILabels that change images/textColors for a day theme and a night theme (trying to be automatically set). My issue is that I set the images and colors when the table is populated with cellForRowAtIndexPath and its during the day "theme", then if I reopen the app hours later in the night "theme" and the app is still in the "background" and not needing to be reloaded (ie viewDidLoad doesn't fire), the day "theme" shows until I scroll the UITableView and then the night "theme" shows when new cells are brought into view by scrolling. How should I set the objects in my cells when changing around time of the day? I was thinking to use an NSTimer, but I'm not sure how to update the objects in my cells. I was also thinking about using the appropriate methods in the AppDelagate to set things in motion, but is there a way to force reloading the TableView? Any suggestions?

    Read the article

  • Changing UITableViewCell height on a grouped cell doesn't look good

    - by Sheehan Alam
    I have a UITableView with 3 sections. In the first section I have 2 grouped cells. I am modifying the first cell to be larger than the second. Though the first cell resizes, it seems to mess up the cell below it. How can I resolve this? - (CGFloat)tableView:(UITableView *)tblView heightForRowAtIndexPath:(NSIndexPath *)indexPath { CGFloat rowHeight; if(indexPath.section == kBioSection) { switch(indexPath.row) { case kBioSectionDescriptionRow: rowHeight = 100; break; } } else { rowHeight = 50; } return rowHeight; }

    Read the article

  • cellForRowAtIndexPath: crashes when trying to access the indexPath.row/[indexPath row]

    - by Emil
    Hey. I am loading in data to a UITableView, from a custom UITableViewCell (own class and nib). It works great, until I try to access the indexPath.row/[indexPath.row]. I'll post my code first, it will probably be easier for you to understand what I mean then. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CustomCell"; CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil){ NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; for (id currentObject in topLevelObjects){ if ([currentObject isKindOfClass:[CustomCell class]]){ cell = (CustomCell *) currentObject; break; } } } NSLog(@"%@", indexPath.row); // Configure the cell... NSUInteger row = indexPath.row; cell.titleLabel.text = [postsArrayTitle objectAtIndex:indexPath.row]; cell.dateLabel.text = [postsArrayDate objectAtIndex:indexPath.row]; cell.cellImage.image = [UIImage imageWithContentsOfFile:[postsArrayImg objectAtIndex:indexPath.row]]; NSLog(@"%@", indexPath.row); return cell; } The odd thing is, it does work when it loads in the first three cells (they are 125px high), but crashes when I try to scroll down. The indexPath is always avaliable, but not the indexPath.row, and I have no idea why it isn't! Please help me.. Thanks. Additional error code: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5d10c20' *** Call stack at first throw: ( 0 CoreFoundation 0x0239fc99 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x024ed5de objc_exception_throw + 47 2 CoreFoundation 0x023a17ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x02311496 ___forwarding___ + 966 4 CoreFoundation 0x02311052 _CF_forwarding_prep_0 + 50 5 MyFancyAppName 0x00002d1c -[HomeTableViewController tableView:cellForRowAtIndexPath:] + 516 [...])

    Read the article

  • Toolbar hiding on rotated UISplitView DetailView

    - by Gerry
    I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape? BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview? Thanks, Gerry

    Read the article

  • By using " editingStyleForRowAtIndexPath " method , " didSelectRowAtIndexPath " method is not calle

    - by Madan Mohan
    Hi, the delegate method not called -(void)viewWillAppear:(BOOL)animated { [theTableView setEditing:TRUE animated:TRUE]; } -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleDelete; } by calling the above the methods i will get minus component before each cell in table view. But the below method didSelectRowAtIndexPath is not called and disclouser indicator is not in visible. (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [theTableView deselectRowAtIndexPath:indexPath animated:YES]; ContactEditViewCotroller *contactEditViewCotroller=[[ContactEditViewCotroller alloc]init]; contactEditViewCotroller.isEdit=isEdit; if(isEdit == YES) { for(int i=0; i<=[editObject.contactList count]-1;i++) { if(indexPath.section == i) { appDelegate.isAddInEdit=NO; editcontacts = [editObject.contactList objectAtIndex:i]; contactEditViewCotroller.editcontacts=editcontacts; indexRow=i; } } } else { for(int i=0; i<=[addContactList count]-1;i++) { if(indexPath.section == i) { appDelegate.isAddInEdit=NO; Contacts *obj = [addContactList objectAtIndex:i]; contactEditViewCotroller.addcontacts=obj; } } } [[self navigationController] pushViewController:contactEditViewCotroller animated:YES]; [contactEditViewCotroller release]; }

    Read the article

  • Push different views from a table.

    - by Tanner
    Hello All, Ive been following a tutorial to implement a search bar ( http://www.iphonesdkarticles.com/2009/01/uitableview-searching-table-view.html ) However I cant seem to push different views. Here is what my didsSelectRowAtIndexPath looks like. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *selectedCountry = nil; if(searching) selectedCountry = [copyListOfItems objectAtIndex:indexPath.row]; else { NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section]; NSArray *array = [dictionary objectForKey:@"Countries"]; selectedCountry = [array objectAtIndex:indexPath.row]; } //Initialize the detail view controller and display it. if ([[listOfItems objectAtIndex:indexPath.row] isEqual:@"neon"]){ Neon *abo = [[Neon alloc] initWithNibName:@"Neon" bundle:nil]; //dvController.selectedCountry = selectedCountry; [self.navigationController pushViewController:abo animated:YES]; [abo release]; } } And here is the debuger message when I click on neon: 2010-05-09 08:47:27.516 iTeachU[3821:307] * Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSMutableArray objectAtIndex:]: index 60 beyond bounds [0 .. 0]' ** Call stack at first throw: terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”. If anyone has a way to push views based on the cells text it would be greatly appreciated. Thanks

    Read the article

  • How set accessory type when tabel view is enbled to editing?

    - by Madan Mohan
    Hi Guys, I am using the UITableView properties to edit it. theTableView.editing = YES; theTableView.allowsSelectionDuringEditing = YES; It is working fine, the row is selected and I am getting into the next controller but I need to display the the accessoryType in the row. I am using below line for that but even though it is not working. Is there any property or any thing missing to display the indiactor. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; I am using the below code for table view. theTableView = [[UITableView alloc] initWithFrame:tableRect style:UITableViewStyleGrouped]; theTableView.editing = YES; theTableView.allowsSelectionDuringEditing = YES; theTableView.delegate = self; theTableView.dataSource = self; theTableView.scrollEnabled=YES; theTableView.separatorColor = [UIColor lightGrayColor]; theTableView.autoresizingMask=YES; theTableView.allowsSelection=YES; theTableView.sectionHeaderHeight=5; theTableView.sectionFooterHeight=5; [myView addSubview:theTableView]; Please help me. THank You, Madan Mohan

    Read the article

  • Problem with reusing UITableViewCell's

    - by Sheehan Alam
    I have a UITableView that is re-using cells when the user scrolls. Everything appears and scrolls fine, except when the user clicks on an actual row, the highlighted cell displays some text from another cell. I'm not exactly sure why. #define IMAGE_TAG 1111 #define LOGIN_TAG 2222 #define FULL_NAME_TAG 3333 // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; STUser *mySTUser = [[[STUser alloc]init]autorelease]; mySTUser = [items objectAtIndex:indexPath.row]; AsyncImageView* asyncImage = nil; UILabel* loginLabel = nil; UILabel* fullNameLabel = nil; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } else { asyncImage = (AsyncImageView *) [cell.contentView viewWithTag:IMAGE_TAG]; loginLabel = (UILabel *) [cell.contentView viewWithTag:LOGIN_TAG]; fullNameLabel = (UILabel *) [cell.contentView viewWithTag:FULL_NAME_TAG]; } // Configure the cell... cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; CGRect frame = CGRectMake(0, 0, 44, 44); asyncImage = [[[AsyncImageView alloc]initWithFrame:frame] autorelease]; asyncImage.tag = IMAGE_TAG; NSURL* url = [NSURL URLWithString:mySTUser.avatar_url_large]; [asyncImage loadImageFromURL:url]; [cell.contentView addSubview:asyncImage]; loginLabel.tag = LOGIN_TAG; CGRect loginLabelFrame = CGRectMake(60, 0, 200, 10); loginLabel = [[[UILabel alloc] initWithFrame:loginLabelFrame] autorelease]; loginLabel.text = [NSString stringWithFormat:@"%@",mySTUser.login]; [cell.contentView addSubview:loginLabel]; fullNameLabel.tag = FULL_NAME_TAG; CGRect fullNameLabelFrame = CGRectMake(60, 20, 200, 10); fullNameLabel = [[[UILabel alloc] initWithFrame:fullNameLabelFrame] autorelease]; fullNameLabel.text = [NSString stringWithFormat:@"%@ %@",mySTUser.first_name, mySTUser.last_name]; //[NSString stringWithFormat:@"%@",mySTUser.login]; [cell.contentView addSubview:fullNameLabel]; return cell; }

    Read the article

  • Why I got a "sent to freed object error"?

    - by Tattat
    I have a Table View, and CharTableController, the CharTableController works like this: .h: #import <Foundation/Foundation.h> @interface CharTableController : UITableViewController <UITableViewDelegate, UITableViewDataSource>{ // IBOutlet UILabel *debugLabel; NSArray *listData; } //@property (nonatomic, retain) IBOutlet UILabel *debugLabel; @property (nonatomic, retain) NSArray *listData; @end The .m: #import "CharTableController.h" @implementation CharTableController @synthesize listData; - (void)viewDidLoad { NSArray *array = [[NSArray alloc] initWithObjects:@"Sleepy", @"Sneezy", @"Bashful", @"Happy", @"Doc", @"Grumpy", @"Dopey", @"Thorin", @"Dorin", @"Nori", @"Ori", @"Balin", @"Dwalin", @"Fili", @"Kili", @"Oin", @"Gloin", @"Bifur", @"Bofur", @"Bombur", nil]; self.listData = array; [array release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; } return cell; } @end And I Use the IB to link the TableView's dataSource and delegate to the CharTableController. In the CharTableController's view is the TableView in IB obviously. Reference Object in dataSource TableView and delegate TableView. What's wrong with my setting? thz.

    Read the article

  • iPhone: Creating a hierarchy-based table navigation.

    - by Jack Griffiths
    Hi there, I've tried to ask this before, but nothing got answered. Basically, I would like someone to explain to me how to create a table, which when a cell is tapped, pushes the user to the next view for that cell. I have this so far: Click here to view what I have. I would further like to, say when CSS is tapped, it goes to a new view which has another table in it. This table would then take the user to a detail view, which is scrollable and you can switch pages through it. I would appreciate longer, more structured tutorials on how to do each and every bit to get it to work. Here's my array in my implementation file: - (void)viewDidLoad { arryClientSide = [[NSArray alloc] initWithObjects:@"CSS", @"HTML", @"JavaScript", @"XML", nil]; arryServerSide = [[NSArray alloc] initWithObjects:@"Apache", @"PHP", @"SQL", nil]; self.title = @"Select a Language"; [super viewDidLoad]; } and my .h: @interface RootViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> { IBOutlet UITableView *tblSimpleTable; NSArray *arryClientSide; NSArray *arryServerSide; } My current code crashes the script, and this error is returned in the console: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "NextView" nib but didn't get a UITableView.' If that error is the source of why it's not pushing, then an explanation of how to remedy that would also be appreciated Many thanks, Jack

    Read the article

  • Using a UITableViewController with a small-sized table?

    - by rpj
    When using a UITableViewController, the initWithStyle: method automatically creates the underlying UITableView with - according to the documentation - "the correct dimensions". My problem is that these "correct dimensions" seem 320x460 (the iPhone's screen size), but I'm pushing this TableView/Controller pair into a UINavigationController which is itself contained in a UIView, which itself is about half the height of the screen. No frame or bounds wrangling I can come up with seems to correctly reset the table's size, and as such it's "too long", meaning there are a collection of rows that are pushed off the bottom of the screen and are not visible nor reachable by scrolling. So my question comes down to: what is the proper way to tell a UITableViewController to resize its component UITableView to a specified rectangle? Thanks! Update I've tried all the techniques suggested here to no avail, but I did find one interesting thing: if I eschew the UINavigationController altogether (which I'm not yet willing to do for production, but as an experiment), and add the table view as a direct subview of the enclosing view I mentioned, the frame size given is respected. The very moment I re-introduce the UINavigationController into the mix, no matter if it is added as a subview before or after the table view, and no matter if alloc/init it before or after the table view is added as a subview, the result is the same as it was before. I'm beginning to suspect UINavigationController isn't much of a team player... Update 2 The suggestion to check frame size after the table view on screen was a good one: turns out that the navigation controller is in fact resizing it some time in between load and display. My solution, hacky at best, has been to cache the frame given on load and to reset it if changed at the beginning of tableView:cellForRowAtIndexPath:. Why there you ask? Because it's the one place I found that worked, that's why! I don't consider this a solution as it's obviously improper, but for the benefit of anyone else reading, it does seem to work.

    Read the article

  • Removing NSLog breaks compiler

    - by DVG
    Okay, so this is weird I have this code - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.row) { case 1: NSLog(@"Platform Cell Selected"); AddGamePlatformSelectionViewController *platformVC = [[AddGamePlatformSelectionViewController alloc] initWithNibName:@"AddGamePlatformSelectionViewController" bundle:nil]; platformVC.context = context; platformVC.game = newGame; [self.navigationController pushViewController:platformVC animated:YES]; [platformVC release]; break; default: break; } } Which works fine. When I remove the NSLog Statement, like so: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.row) { case 1: //NSLog(@"Platform Cell Selected"); AddGamePlatformSelectionViewController *platformVC = [[AddGamePlatformSelectionViewController alloc] initWithNibName:@"AddGamePlatformSelectionViewController" bundle:nil]; platformVC.context = context; platformVC.game = newGame; [self.navigationController pushViewController:platformVC animated:YES]; [platformVC release]; break; default: break; } } I get the following compiler errors /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:102:0 /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:102: error: expected expression before 'AddGamePlatformSelectionViewController' /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:103:0 /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:103: error: 'platformVC' undeclared (first use in this function) If I just edit out the two // for commenting out that line, everything works swimingly.

    Read the article

  • How to assign a table view controller to a table view on iPhone?

    - by Tattat
    I have a CharTableController, View and TableView on my IB. The CharTableController is using "CharTableController" in class identity. And this is how I implemented in the .h, and I want use the "CharTableController" to control the table only: @interface CharTableController : UITableViewController <UITableViewDelegate, UITableViewDataSource>{ // IBOutlet UILabel *debugLabel; NSArray *listData; } //@property (nonatomic, retain) IBOutlet UILabel *debugLabel; @property (nonatomic, retain) NSArray *listData; @end It is the .m: #import "CharTableController.h" @implementation CharTableController @synthesize listData; - (void)viewDidLoad { //NSLog(@"bulll"); // [debugLabel setText:@"success"]; NSArray *array = [[NSArray alloc] initWithObjects:@"A", @"B", @"C", @"D", @"E", nil]; self.listData = array; [array release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; } return cell; } @end In the IB, I already assign the CharTableController's view to Table View in IB. And Table View is under the View, in IB. After I run the program, I can see the table view, but I can't see any char in the table view, why? What's wrong with my code? thz.

    Read the article

  • How do I resize table view after resizing it's footer?

    - by Pedro
    I have a UITableView with header & footer added with code following the pattern shown in Apple's recipes example so the code for the footer is... if (tableFooterView == nil) { [[NSBundle mainBundle] loadNibNamed:@"DetailFooterView" owner:self options:nil]; self.tableView.tableFooterView = tableFooterView; } The footer NIB contains nothing more than a UITextView & I set text & resize with... CGSize size = [footerText sizeWithFont:[footerTextView font] constrainedToSize:CGSizeMake(304.0, 500.0)]; CGRect frame = CGRectMake(8.0, 0.0, size.width, size.height + 24.0); footerTextView.frame = frame; footerTextView.text = footerText; [tableFooterView sizeToFit]; That all works however I can't get the UITableView to resize around the resized footer. If I set the original size of the footer for any possible text I have a big whitespace in most cases. If I set it smaller then I can push the view up to see the whole text but it bounces back on release. I've tried [[self view] sizeToFit]; but that doesn't work. Can anyone fill me in? Cheers & TIA, Pedro :)

    Read the article

  • Why won't my UITableViewCell deselect and update its text?

    - by Josh
    I have a UITableView with a list of stories and a cell at the bottom that loads more stories. I am trying to make the "More Stories..." cell deselect and change its text to "Loading..." when clicked. I have searched all over the internet and all over stackoverflow and I cant figure out why my code isnt working right. Right now, when the "More Stories..." cell is clicked, it stays selected and doesnt ever change its text. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; if (storyIndex == [stories count]) { UITableViewCell *moreCell = [tableView dequeueReusableCellWithIdentifier:@"more"]; if (moreCell == nil) { moreCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"more"] autorelease]; } // Set up the cell moreCell.textLabel.text = @"Loading..."; [tableView deselectRowAtIndexPath:indexPath animated:YES]; [self moreStories]; } else { NSLog(@"%@",[[stories objectAtIndex: storyIndex] objectForKey: @"link"]); webViewController *webController; webController = [[webViewController alloc] initWithURLPassed:[[stories objectAtIndex: storyIndex] objectForKey: @"link"]]; [self.navigationController pushViewController:webController animated:YES]; [webController release]; webController =nil; self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; } }

    Read the article

  • Is there a way to update the height of a single UITableViewCell, without recalculating the height for every cell?

    - by Chris Vasselli
    I have a UITableView with a few different sections. One section contains cells that will resize as a user types text into a UITextView. Another section contains cells that render HTML content, for which calculating the height is relatively expensive. Right now when the user types into the UITextView, in order to get the table view to update the height of the cell, I call [self.tableView beginUpdates]; [self.tableView endUpdates]; However, this causes the table to recalculate the height of every cell in the table, when I really only need to update the single cell that was typed into. Not only that, but instead of recalculating the estimated height using tableView:estimatedHeightForRowAtIndexPath:, it calls tableView:heightForRowAtIndexPath: for every cell, even those not being displayed. Is there any way to ask the table view to update just the height of a single cell, without doing all of this unnecessary work? Update I'm still looking for a solution to this. As suggested, I've tried using reloadRowsAtIndexPaths:, but it doesn't look like this will work. Calling reloadRowsAtIndexPaths: with even a single row will still cause heightForRowAtIndexPath: to be called for every row, even though cellForRowAtIndexPath: will only be called for the row you requested. In fact, it looks like any time a row is inserted, deleted, or reloaded, heightForRowAtIndexPath: is called for every row in the table cell. I've also tried putting code in willDisplayCell:forRowAtIndexPath: to calculate the height just before a cell is going to appear. In order for this to work, I would need to force the table view to re-request the height for the row after I do the calculation. Unfortunately, calling [self.tableView beginUpdates]; [self.tableView endUpdates]; from willDisplayCell:forRowAtIndexPath: causes an index out of bounds exception deep in UITableView's internal code. I guess they don't expect us to do this. I can't help but feel like it's a bug in the SDK that in response to [self.tableView endUpdates] it doesn't call estimatedHeightForRowAtIndexPath: for cells that aren't visible, but I'm still trying to find some kind of workaround. Any help is appreciated.

    Read the article

  • How to change the border color of a Grouped UITableView

    - by ctpenrose
    This concerns iPhoneOS-sdk-3.2 I am having difficulty changing the border color of a grouped UITableView. I can change the cell background color, separator color, text color, quite easily now, and the rounded corners clip correctly, even when highlighted with whatever colors I have chosen. However the surrounding border remains infuriatingly gray despite many different attempts. I have read all of the related posts I can find via Google, let alone stackoverflow. I have tried both a programmatic and xib-based solution and both provide the same results. I will share the programmatic version below: I have a UIViewController subclass rather than a UITableViewController subclass to act as a UITableView delegate -- I chose this route as I am coding on the iPad and UITableViewController reportedly takes over the whole screen. loadView method of my UIViewController subclass: - (void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view release]; self.view.backgroundColor = [UIColor blackColor]; // add and configure UITableView CGRect tableViewRect = CGRectMake(0., 0., 256., 768.); myTableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStyleGrouped]; // set the tableview delegate to this object and the datasource to the datasource which has already been set myTableView.delegate = self; myTableView.dataSource = self; myTableView.sectionIndexMinimumDisplayRowCount=1; myTableView.backgroundColor = [UIColor clearColor]; myTableView.separatorColor = [UIColor whiteColor]; myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; myTableView.opaque = NO; // add the table view to our background view [self.view addSubview:myTableView]; [myTableView release]; }

    Read the article

  • populate UITableView from json

    - by mcgrailm
    Hello all working on my building my first iDevice app and I am trying to populate a UITableView with data from json result I can get it to load from plist array no propblem and I can even see my json the problem I'm having is that the UITableView never gets to see the json results please bare with me as this is first time with obj-c or anything like it in my .h file @interface TableViewViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> { NSArray *exercises; NSMutableData *responseData; } in my .m file - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return exercises.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //create a cell UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; // fill it with contnets cell.textLabel.text = [exercises objectAtIndex:indexPath.row]; // return it return cell; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { responseData = [[NSMutableData data] retain]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://url_to_json"]]; [[NSURLConnection alloc] initWithRequest:request delegate:self ]; // load from plist //NSString *myfile = [[NSBundle mainBundle] pathForResource:@"exercise" ofType:@"plist"]; //exercises = [[NSArray alloc] initWithContentsOfFile:myfile]; [super viewDidLoad]; } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [responseData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [responseData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"Connection failed: %@", [error description]); } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; [responseData release]; NSDictionary *dictionary = [responseString JSONValue]; NSArray *response = [dictionary objectForKey:@"response"]; exercises = [[NSArray alloc] initWithArray:response]; }

    Read the article

  • How do I make UITableViewCellAccessoryDisclosureIndicator visible in black background?

    - by Amit Vaghela
    Hi I wrote this cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; in this method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; but I can only see it when I select that cell otherwise it's not visible.and it work perfectly when background is white. I am sure that I need to set a property, but I don't know which property I need to change to make this thing work. thanks in advance. cheers.

    Read the article

  • After resizing label on tap on tableview cell tableview content order changes iphone sdk

    - by neha
    Hi all, In my application I'm dynamically resizing a label in cell as well as cell when a cell is tapped in uitableview, but after resizing the label in cell, the contents in the tableview are getting shifted means the cells contain different cell content after this tap, whereas this' not the case when I'm tapping the cell and expanding it without expanding the label in it. Can anybody please help? It's urgent. Thanks in advance.

    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

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >