Search Results

Search found 1119 results on 45 pages for 'tableview'.

Page 15/45 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • trying to delete a song from a list UITableView sigbart error - addMusic Example

    - by Pavan
    hi im trying to implement a delete feature into the addmusic example this is the code ive added it doesnt work, i cant get my head around whats wrong. can someone please tell me whats wrong and what i need to do to make sure it works. - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { // If row is deleted, remove it from the list. if (editingStyle == UITableViewCellEditingStyleDelete) { MainViewController *mainViewController = (MainViewController *) self.delegate; NSUInteger index = [indexPath row]; MPMediaItem *itemToDelete = [mainViewController.userMediaItemCollection mediaItemAtIndex:index]; if ([itemToDelete isEqual:mainViewController.musicPlayer.nowPlayingItem]) { [mainViewController.musicPlayer skipToNextItem]; } MPMediaItemCollection *newCollection = [mainViewController.userMediaItemCollection collectionByDeletingMediaItemAtIndex:index]; mainViewController.userMediaItemCollection = newCollection; NSUInteger indices[] = {0, index}; NSIndexPath *deletePath = [NSIndexPath indexPathWithIndexes:indices length:2]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:deletePath] withRowAnimation:UITableViewRowAnimationFade]; I also get these warnings when i compile the program and run it: heres the image: http://www.freeimagehosting.net/uploads/6e42f166b9.png Any ideas and help appreciated.

    Read the article

  • UITableViewCells appear behind backgroundView

    - by Khanzor
    I am having a problem setting the background of UITableView to a UIImageView (see below for why I am doing this), once the view is set, it works fine, and scrolls with the UITableView, but it hides the elements of the Table View. I need to have a UIImageView as the background for a UITableView. I know this has been answered before, but the answers are to use: [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]]; Or something like (which I need to use): UIImageView *background = [MainWindow generateBackgroundWithFrame:tableView.bounds]; [tableView addSubview:background]; [tableView sendSubviewToBack:background]; The reason I need to use the latter is because of my generateBackgroundWithFrame method, which takes a large image, and draws a border around that image to the dimensions specified, and clips the remainder of the image: + (UIImageView *) generateBackgroundWithFrame: (CGRect)frame { UIImageView *background = [[[UIImageView alloc] initWithFrame:frame] autorelease]; background.image = [UIImage imageNamed:@"globalBackground.png"]; [background.layer setMasksToBounds:YES]; [background.layer setCornerRadius:10.0]; [background.layer setBorderColor:[[UIColor grayColor] CGColor]]; [background.layer setBorderWidth:3.0]; return background; } Please note: I understand that this might poorly effect performance, but I don't have the resources to go through and make those images for each potential screen in the app. Please do not answer this question with a mindless "you shouldn't do this" response. I am aware that it is possibly the wrong thing to do. How do I show my UITableView control elements? Is there something that I am doing wrong in my delegate? Here is a simplified version: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(20, 20, 261, 45) reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; UIImage *rowBackground; NSString *imageName = @"standAloneTVButton.png"; rowBackground = [UIImage imageNamed:imageName]; UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 5, 300, 200)]; textView.backgroundColor = [UIColor clearColor]; textView.textColor = [UIColor blackColor]; textView.font = [UIFont fontWithName:@"Helvetica" size:18.0f]; Purchase *purchase = [[PurchaseModel productsPurchased] objectAtIndex:indexPath.row]; textView.text = [purchase Title]; selectedTextView.text = textView.text; UIImageView *normalBackground = [[[UIImageView alloc] init] autorelease]; normalBackground.image = rowBackground; [normalBackground insertSubview:textView atIndex:0]; cell.backgroundView = normalBackground; [textView release]; } return cell; }

    Read the article

  • I getting exception, while deleting a row using " commitEditingStyle " method in iPhone simulator.

    - by Madan Mohan
    Hi, I am getting exception by deleting a row from the table view. (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if(isEdit == YES) { if([editObject.contactList count]0) { return [editObject.contactList count]+1; } else { return 1; } } else if(isEdit == NO) { if([addContactList count]0) { return [addContactList count]+1; } else { return 1; } } return 0; } (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { if(isEdit == YES) { int sectionNum=[editObject.contactList count]-1; if([editObject.contactList count]0) { for( int i=0; i<=[editObject.contactList count]-1;i++) { if(indexPath.section == i) { return UITableViewCellEditingStyleDelete; } } if(indexPath.section == sectionNum+1) { return UITableViewCellEditingStyleInsert; } } else { if(indexPath.section == 0) { return UITableViewCellEditingStyleInsert; } } } else { if([addContactList count]0) { int sectionNum=[addContactList count]-1; for( int i=0; i<=[addContactList count]-1;i++) { if(indexPath.section == i) { return UITableViewCellEditingStyleDelete; } } if(indexPath.section == sectionNum+1) { return UITableViewCellEditingStyleInsert; } } else { if(indexPath.section == 0) { return UITableViewCellEditingStyleInsert; } } } return UITableViewCellEditingStyleNone; } (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if(isEdit == YES) { if(editingStyle == UITableViewCellEditingStyleDelete) { for(int i=0;i<=[editObject.contactList count]-1;i++) { if(indexPath.section == i) { [editObject.contactList removeObjectAtIndex:indexPath.row]; [theTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } } } else { //adding } [theTableView reloadData]; } else { if(editingStyle == UITableViewCellEditingStyleDelete) { for(int i=0;i<=[addContactList count]-1;i++) { if(indexPath.section == i) { [addContactList removeObjectAtIndex:indexPath.row]; [theTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; // getting exception here in this line at indexpath [theTableView reloadData]; } } } else { //adding } [theTableView reloadData]; } } the exception as 2010-04-28 13:55:30.063 Zoho[2818:20b] * Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-984.38/UITableView.m:772 2010-04-28 13:55:30.064 Zoho[2818:20b] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (2) must be equal to the number of sections contained in the table view before the update (3), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).' 2010-04-28 13:55:30.065 Zoho[2818:20b] Stack: ( 10490971, 2437656123, 10574907

    Read the article

  • Why are my "tel:" links not working

    - by Griffo
    I have a tableView which has cells with phone numbers. The app is not dialing the numbers though. See the code below - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 2) { UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; NSString *numberToDial = [NSString stringWithFormat:@"tel:%@", selectedCell.detailTextLabel.text]; NSLog(@"%@",numberToDial); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:numberToDial]]; } } Console ouput: 2010-03-08 01:32:30.830 AIB[1217:207] tel:01 8350098 As you can see, the number goes to the console, but doesn't get dialled. The weird thing is, if I change the last statement to this: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:171"]]; the phone dials the number 171 without any issue

    Read the article

  • I'm trying to build a to-do-list application in Objective C but coming up short.

    - by lampShade
    I'm getting this error: -[NSCFArray insertObject:atIndex:]: attempt to insert nil Here is the .m file: /* IBOutlet NSTextField *textField; IBOutlet NSTabView *tableView; IBOutlet NSButton *button; NSMutableArray *myArray; */ #import "AppController.h" @implementation AppController -(IBAction)addNewItem:(id)sender { myArray = [[NSMutableArray alloc]init]; tableView = [[NSTableView alloc] init]; [tableView setDataSource:self]; [textField stringValue]; NSString *string = [[NSString alloc] init]; string = [textField stringValue]; [myArray addObject:string]; NSLog(@"%d",[myArray count]); NSLog(@"%@",string); } - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return [myArray count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { //NSString *data = [myArray objectAtIndex:rowIndex]; return [myArray objectAtIndex:rowIndex]; } @end

    Read the article

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

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

    Read the article

  • iPhone: UITableView Becomes Invisible after Changing the Data it Displays

    - by Alexander Shemshurenko
    Hi I have application with a TabBar that controls several views. In one view, I control connections to different servers. Each server provides a different set of items. I display these items in UITableView on another view. The problem is that the tableview displays OK the first time but if I go back to view number one and change the server, thereby changing the list of items that should be displayed in tableview, the tableview becomes invisible for some reason. If I tap on the screen in the place where it should be, it becomes visible again. I create table view like this UITableView * aTableView = [[UITableView alloc] initWithFrame:CGRectMake(X,Y,Width,Height) style:UITableViewStyleGrouped]; [[self view] addSubview:aTableView]; aTableView.dataSource = self; Ive tried to call reloadData and setNeedsDisplay in viewWillAppear of the UIViewController that hosts this tableview but without success. Any advice? Thanks

    Read the article

  • Memory problem with basic UITableView when scrolling

    - by Sheehan Alam
    I have a very simple UITableView that has 3 sections, and 3 rows per section. #pragma mark - #pragma mark UITableView delegate methods - (NSInteger)tableView:(UITableView *)tblView numberOfRowsInSection:(NSInteger)section { return 3; } - (UITableViewCell *)tableView:(UITableView *)tblView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tblView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... return cell; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tblView { if (tblView == self.tableView) { return 3; } else { return 1; } } Everything shows up fine, but as soon as I scroll my application crashes and my debugger tells me: * -[ProfileViewController tableView:cellForRowAtIndexPath:]: message sent to deallocated instance 0x5ae61b0 I'm not exactly sure what I am doing wrong.

    Read the article

  • MIN() and MAX() in Swift and converting Int to CGFloat

    - by gotnull
    I'm getting some errors with the following methods: 1) How do I return screenHeight / cellCount as a CGFLoat for the first method? 2) How do I use the equivalent of ObjC's MIN() and MAX() in the second method? func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat { var cellCount = Int(self.tableView.numberOfRowsInSection(indexPath.section)) return screenHeight / cellCount as CGFloat } // #pragma mark - UIScrollViewDelegate func scrollViewDidScroll(scrollView: UIScrollView) { let height = CGFloat(scrollView.bounds.size.height) let position = CGFloat(MAX(scrollView.contentOffset.y, 0.0)) let percent = CGFloat(MIN(position / height, 1.0)) blurredImageView.alpha = percent }

    Read the article

  • setContentOffset only works if animated is set to YES

    - by Sheehan Alam
    I have a UITableView which I would like to be displayed 100px down. For some reason this only works when animated is set to YES. Why is this? - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO];*/ /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndex:1] atScrollPosition:UITableViewScrollPositionNone animated:NO];*/ [self.tableView setContentOffset:CGPointMake(0,100) animated:YES]; }

    Read the article

  • How to set the Cell height as dynamically in iPhone?

    - by Pugal Devan
    Hi Friends, In my apps, i have created table view and displayed the images and the labels in the table view. I have downloaded the image and set the image height into the another class, so i have set the image height as delegate value. In my problem is, heightForRowAtIndexPath method is call very earlier and it never calls again. So how i set the cell height depends on the image height? - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { In Console: the height of the image is --------------------------0.000000 the height of the image is --------------------------0.000000 the height of the image is --------------------------0.000000 } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { In Console: the height of the image is --------------------------98.567039 the height of the image is --------------------------300.000000 the height of the image is --------------------------232.288406 } Is any possible to call the heightforRowAtIndexPath method inside the cellForRowAt method. Because i have set the cell frame size and height depends on the image height. So how can i set the cell height depends on the image height?, please guide me. Thanks!

    Read the article

  • UITableViewCell outlets not set during bundle load (possibly very elementary question)

    - by Jan Zich
    What are the most common reasons for an outlet (a class property) not being set during a bundle load? I'm sorry; most likely I'm not using the correct terms. It's my first steps with iPhone OS development and Objective-C, so please bear with me. Here is more details. Basically, I'm trying to create a table view based form with a fixed number of static rows. I followed this example: http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/TableView_iPhone/TableViewCells/TableViewCells.html Scroll down to The Technique for Static Row Content please. I have one nib file with one table view, three table cells and all connections set as in the example. The problem is that the corresponding cell properties in my controller are never initialised. I get an exception in cellForRowAtIndexPath complaining that the returned cell is nil: UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath. Here are the relevant parts from the implementation of the controller: @synthesize cellA; @synthesize cellB; @synthesize cellC; - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.row) { case 0: return cellA; break; case 1: return cellB; break; case 2: return cellC; break; default: return nil; } } And here is the interface part: @interface AssociatePhoneViewController : UITableViewController { UITableViewCell *cellA; UITableViewCell *cellB; UITableViewCell *cellB; } @property (nonatomic, retain) IBOutlet UITableViewCell *cellA; @property (nonatomic, retain) IBOutlet UITableViewCell *cellB; @property (nonatomic, retain) IBOutlet UITableViewCell *cellC; @end This must be possibly one of the the most embarrassing questions on StackOverflow. It looks like the most basic example code. Is is possible that the cells are not instantiated with the nib file? I have them on the same level before the tabula view in the nib file. I tried to move them after the table view, but it did not make any difference. Are table cells in some way special? Do I need to set some flag or some property on them in the nib file? I was under the impression that all classes (views, windows, controllers …) listed in a nib file are simply instantiated (and linked using the provided connections). Could it possibly be some memory issue? The cell properties in my controller are not defined in any special way.

    Read the article

  • Bug in UITableView: Why is the section header covered by an row after deleting an row?

    - by mystify
    When I delete a row like this, and then scroll a little bit, one of the rows of that section happens to cover the section header. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [dataManager deleteValueAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } } Is there any solution to this?

    Read the article

  • How to do a UITable cell with triangle indicator?

    - by zardon
    In the Linked in iphone application I noticed that they have a tableview, see the following picture with what appears to have a triangle indicator pointing upwards. Notice how the tableview cell has a little triangle pointing upwards and is part of a tableview cell. The triangle is the ---^--- part of the image. I'm wondering. How do you make a UITableView with this triangle indicator, and what is this effect called? Thanks

    Read the article

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

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

    Read the article

  • Data sources and NSTableView

    - by lampShade
    I know that table sources need a data source to hold the data that the tableview will display. Lets' say that I'm going to make my AppController be the data source of my tableview and that I make the connection in interface builder. My question is since my actual data is going to be stored in an array,let's call it myArray, when I set the data source in code should I do this [tableView setDataSource:myArray]; or this [tableView setDataSource:self]; I'm confused about this. setting the data source with the keyword "self" would set it to the AppController if I'm not mistaken.

    Read the article

  • iPhone: Crash When Deleting UITableView Rows

    - by Ajeet Kumar Yadav
    Hi, I am new in iPhone development. I am developing an application that fetches a value from a database and displays it in a table view. I want to delete table rows one by one but the rows do not delete and the application crashes. Here is my row deletion code: - (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if(editingStyle == UITableViewCellEditingStyleDelete) { SanjeevKapoorAppDelegate *appDelegate =(SanjeevKapoorAppDelegate *)[[UIApplication sharedApplication] delegate]; list *animal =[appDelegate.list1 objectAtIndex:indexPath.row]; [appDelegate deleteCoffee]; [self.tableView reloadData]; //Delete the object from the table. [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } I also delete all rows with this action: -(IBAction)deletebtn:(id)sender{ SanjeevKapoorAppDelegate *appDelegate =(SanjeevKapoorAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate deleteCoffee]; [self.tableView reloadData]; } How do I properly implement delete in an UITableView?

    Read the article

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

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

    Read the article

  • iPhone: Setup static content of UITableView

    - by Martin
    This guide from apple https://developer.apple.com/iphone/prerelease/library/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html (you need login) explains how to use "The Technique for Static Row Content" to use Interface Builder to setup the cells in a tableview. I have some cells with different heights in my tableview. Without using the heightForRowAtIndexPath method everything get messed up. Do I still need to use this method or can I in some way setup the height of the cells inside the IB as I created them there? Also when using the "The Technique for Static Row Content" from the guide you still need to use the cellForRowAtIndexPath to setup the cells even if they are created in IB. I would like to setup the full layout of the tableview with all cells in IB (drag the cells right into the tableview), is that possible in some way? Thanks!

    Read the article

  • Properly releasing UITableViewController and UITableView directly added to a UIViewController

    - by JK
    I have a UIViewController (parentVC) to which I add a UITableViewController as follows (it is not pushed since the tableview only occupies about half the screen): tableVC = [[SmallTableVC alloc] initWithStyle:UITableViewStylePlain]; [self.view addSubview:tableVC.tableView]; In dealloc, I add [tableVC release]; Using instruments, I can see that the tableVC is indeed fully released when parentVC released, which is good, but I am not sure why as I thought that the UITableView of tableVC would have a retain count of 2 (1 for retention by tableVC and 1 for retention by parentVC). My intuition was that an additional [tableVC.tableView release] would be required, but adding it crashes the app. Why is tableVC released properly by the current code (if indeed it actually is)? Does a UITableViewController not retain its tableView? Thanks.

    Read the article

  • reloading table

    - by edie
    Hi... I've have a table view that consist of item list that depends on the item that were purchased using in app purchasing. My question was how can I reload the tableView when the purchasing was completed/(or when new item was added on my list). The response of the storekit takes time to complete. Are there anyways to tell the app that the purchasing was completed and new item was added on my list so that I can reload my tableView. At this time I reloading my table view by adding [myTableView reloadData] in viewWillAppear method. But what if the user was already viewing the tableView, I can't reload the tableView because the viewWillAppear had passed. thanks...

    Read the article

  • How can I replace a UITableViewController with a UIViewController that contains a UITableView?

    - by Dr Dork
    I created a new SplitView iPad project in Xcode and setup the code to populate the TableView (in the RootView on the left) with data. Now I'd like to customize the RootView to contain a DatePicker view along with the TableView, but I'm unsure how to accomplish this. Since the default RootViewController is a subclass of a UITableViewController, I couldn't add a DatePicker view to it in IB (since you can't add a DatePicker to a UITableView). The only way I understand to accomplish my goal of adding a DatePicker to the "Left" RootView is to change the RootViewController from a subclass of a UITableViewController to a subclass of a UIViewController, then I'll be able to add a view to it that contains a DatePicker view and a TableView using IB. Questions... Is this the correct approach to add a DatePicker to the "Left" RootView? If so and I change the RootViewController to a subclass of a UIViewController (instead of a UITableViewController) and add to it a TableView (along with the DatePicker), how will that affect the code I currently have in place for populating my current TableView? Thanks so much for all your help! Below is my current interface code for my RootViewController, if it'll help any. @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> { DetailViewController *detailViewController; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; @property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; - (void)insertNewObject:(id)sender; @end

    Read the article

  • Faking a UITableView selection

    - by John Smith
    I have a UITableView where a selection displays some cool stuff in another part of the display. I tried to fake a keypress by writing: NSIndexPath *ip = [NSIndexPath indexPathForRow: 1 inSection:0]; [tableView selectRowAtIndexPath:ip animated:NO scrollPosition:UITableViewScrollPositionTop ]; [self tableView:tableView didSelectRowAtIndexPath:ip]; However it seems the last line is not being run. How can I make it run?

    Read the article

  • First and last UITableViewCell keep changing while scrolling.

    - by W Dyson
    I have a tableView with cells containing one UITextField as a subview for each cell. My problem is that when I scroll down, the text in the first cell is duplicated in the last cell. I can't for the life if me figure out why. I have tried loading the cells from different nibs, having the textFields as ivars. The UITextFields don't seem to be the problem, I'm thinking it has something to do with the tableView reusing the cells. The textFields all have a data source that keeps track of the text within the textField and the text is reset each time the cell is shown. Any ideas? UPDATE: Thanks guys, here's a sample: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Section %i, Row %i", indexPath.section, indexPath.row); static NSString *JournalCellIdentifier = @"JournalCellIdentifier"; UITableViewCell *cell = (UITableViewCell *)[self.tableView dequeueReusableCellWithIdentifier:JournalCellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:JournalCellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.accessoryType = UITableViewCellAccessoryNone; } if (indexPath.section == 0) { UITextField *textField = (UITextField *)[self.authorCell viewWithTag:1]; [cell addSubview:textField]; self.authorTextField = textField; self.authorTextField.text = [self.textFieldDictionary objectForKey:@"author"]; NSLog(@"Reading Author:%@", [self.textFieldDictionary objectForKey:@"author"]); } else if (indexPath.section == 1) { UITextField *textField = (UITextField *)[self.yearCell viewWithTag:1]; [cell addSubview:textField]; self.yearTextField = textField; self.yearTextField.text = [self.textFieldDictionary objectForKey:@"year"]; NSLog(@"Reading Year:%@", [self.textFieldDictionary objectForKey:@"year"]); } else if (indexPath.section == 2) { UITextField *textField = (UITextField *)[self.volumeCell viewWithTag:1]; [cell addSubview:textField]; self.volumeTextField = textField; self.volumeTextField.text = [self.textFieldDictionary objectForKey:@"volume"]; NSLog(@"Reading Volume:%@", [self.textFieldDictionary objectForKey:@"volume"]); } return cell; }

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >