Search Results

Search found 218 results on 9 pages for 'didselectrowatindexpath'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • didSelectRowAtIndexPath does not get called when scrolling and selecting a cell

    - by Falcon
    Hi all, It seems when I scroll my table view that if I select a cell while the table view is still scrolling, didSelectRowAtIndexPath doesn't get called. It works fine when the table view is still. Any ideas on why this might be? Also, is there a way that didSelectRowAtIndexPath can be called on press down? It seems it gets called after my finger/cursor is raised off of the cell. Thanks,

    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

  • Why won't my UISearchDisplayController fire the didSelectRowAtIndexPath moethod?

    - by John Wells
    I am having an odd problem when searching a UITableView using a UISearchDisplayController. The UITableViewController is a subclass of another UITableViewController with a working didSelectRowAtIndexPath method. Without searching the controller handles selections fine, sending the superclass a didSelectRowAtIndexPath call, but if I select a cell when searching the superclass receives nothing but the cell is highlighted. Below is the code from my subclass. @implementation AdvancedViewController @synthesize searchDisplayController, dict, filteredList; - (void)viewDidLoad { [super viewDidLoad]; // Programmatically set up search bar UISearchBar *mySearchBar = [[UISearchBar alloc] init]; mySearchBar.delegate = self; [mySearchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [mySearchBar sizeToFit]; self.tableView.tableHeaderView = mySearchBar; // Programmatically set up search display controller searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:mySearchBar contentsController:self]; [self setSearchDisplayController:searchDisplayController]; [searchDisplayController setDelegate:self]; [searchDisplayController setSearchResultsDataSource:self]; // Parse data from server NSData * jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]]; NSArray * items = [[NSArray alloc] initWithArray:[[CJSONDeserializer deserializer] deserializeAsArray:jsonData error:nil]]; // Init variables dict = [[NSMutableDictionary alloc] init]; listIndex = [[NSMutableArray alloc] init]; fullList = [[NSMutableArray alloc] init]; filteredList = [[NSMutableArray alloc] init]; // Get each item and format it for the UI for(NSMutableArray * item in items) { // Get the first letter NSString * firstKey = [[[item objectAtIndex:0] substringWithRange:NSMakeRange(0,1)] uppercaseString]; // Put symbols and numbers in the same section if ([[firstKey stringByTrimmingCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] isEqualToString:@""]) firstKey = @"#"; // If there isn't a section with this key if (![listIndex containsObject:firstKey]) { // Add the key to the index for faster access (because it's already sorted) [listIndex addObject:firstKey]; // Add the key to the unordered dictionary [dict setObject:[NSMutableArray array] forKey:firstKey]; } // Add the object to the dictionary [[dict objectForKey:firstKey] addObject:[[NSMutableDictionary alloc] initWithObjects:item forKeys:[NSArray arrayWithObjects:@"name", @"url", nil]]]; // Add the object to the list for simple searching [fullList addObject:[[NSMutableDictionary alloc] initWithObjects:item forKeys:[NSArray arrayWithObjects:@"name", @"url", nil]]]; } filteredList = [NSMutableArray arrayWithCapacity:[fullList count]]; } #pragma mark - #pragma mark Table view data source // Custom method for object oriented data access - (NSString *)tableView:(UITableView *)tableView dataForRowAtIndexPath:(NSIndexPath *)indexPath withKey:(NSString *)key { return (NSString *)((tableView == self.searchDisplayController.searchResultsTableView) ? [[filteredList objectAtIndex:indexPath.row] objectForKey:key] : [[[dict objectForKey:[listIndex objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row] valueForKey:key]); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return (tableView == self.searchDisplayController.searchResultsTableView) ? 1 : (([listIndex count] > 0) ? [[dict allKeys] count] : 1); } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return (tableView == self.searchDisplayController.searchResultsTableView) ? [filteredList count] : [[dict objectForKey:[listIndex objectAtIndex:section]] count]; } - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return (tableView == self.searchDisplayController.searchResultsTableView) ? [[NSArray alloc] initWithObjects:nil] : listIndex; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return (tableView == self.searchDisplayController.searchResultsTableView) ? @"" : [listIndex objectAtIndex:section]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kCellID = @"cellID"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellID] autorelease]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } NSString * name = nil; // TODO: Make dataForRowAtIndexPath work here if (tableView == self.searchDisplayController.searchResultsTableView) { // NOTE: dataForRowAtIndexPath causes this to crash for some unknown reason. Maybe it is called before viewDidLoad and has no data? name = [[filteredList objectAtIndex:indexPath.row] objectForKey:@"name"]; } else { // This always works name = [self tableView:[self tableView] dataForRowAtIndexPath:indexPath withKey:@"name"]; } cell.textLabel.text = name; return cell; } #pragma mark Search Methods - (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope { // Clear the filtered array [self.filteredList removeAllObjects]; // Filter the array for (NSDictionary *item in fullList) { // Compare the item's name to the search text NSComparisonResult result = [[item objectForKey:@"name"] compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])]; if (result == NSOrderedSame) { // Add to the filtered array if it matches [self.filteredList addObject:item]; } } } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString scope: [[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]]; // Return YES to cause the search result table view to be reloaded. return YES; } - (void)viewDidUnload { filteredList = nil; } @end

    Read the article

  • How to implement action in didSelectRowAtIndexPath of UITableview?

    - by Sumana Mehta
    On my view, I used to have few buttons and each button had an action associated with it. UIButton *testButton = [[UIButton alloc] initWithFrame:CGRectMake(120,300,90,90)]; [testButton setBackgroundImage:[UIImage imageNamed:@"test.jpg"] forState:UIControlStateNormal]; [testButton addTarget:self.view action:@selector(gotoProd:) forControlEvents:UIControlEventTouchUpInside]; [testButton addt [scrollView testButton]; But now I am trying to replace all those buttons with the tableview with rows. I was able to populate the rows and I know one needs to use didSelectRowAtIndexPath for handling on select event of the cell. But how can I implement action:@selector(gotoProd:) in tableviews ?? Any help will be greatly appreciated.

    Read the article

  • Access custom label property at didSelectRowAtIndexPath.

    - by Mr. McPepperNuts
    I have a UILabel for each cell at cellForRowAtIndexPath. UILabel *cellLabel = [[UILabel alloc] initWithFrame:frame]; cellLabel.text = myString; I want to access that string "myString" at didSelectRowAtIndexPath using indexpath. NSString *anotherString = cell.textLabel.text; returns null. Now if at cellForRowAtIndexPath, I did something like cell.textLabel.text = theString; then the didSelectRowAtIndexPath returns the appropriate cell. My question is, how can I access the text in the UILabel I apply to the cell, at didSelectRowAtIndexPath? Also, logging the cell in didSelectRowAtIndexPath returns cell: <UITableViewCell: 0x5dcb9d0; frame = (0 44; 320 44); autoresize = W; layer = <CALayer: 0x5dbe670>> Edit: NSString *myString = [[results objectAtIndex:indexPath.row] valueForKey:@"name"]; //cell.textLabel.text = myString; CGFloat width = [UIScreen mainScreen].bounds.size.width - 50; CGFloat height = 20; CGRect frame = CGRectMake(10.0f, 10.0f, width, height); UILabel *cellLabel = [[UILabel alloc] initWithFrame:frame]; cellLabel.text = myString; cellLabel.textColor = [UIColor blackColor]; cellLabel.backgroundColor = [UIColor whiteColor]; cellLabel.textAlignment = UITextAlignmentLeft; cellLabel.font = [UIFont systemFontOfSize:14.0f]; [cell.contentView addSubview:cellLabel]; [cellLabel release]; return cell;

    Read the article

  • didSelectRowAtIndexPath being called after viewDidLoad of the called view

    - by Serguei Fedorov
    I am trying to pass variables over to the new view. I have the following code: appDelegate *dataCenter = (AppDelegate*)[[UIApplication sharedApplication] delegate]; dataCenter.myVariable = [array objectAtIndex:indexPath.row]; in the didSelectRowAtIndexPath of the calling view. However, the issue that I have is that this variable is empty in the vewDidLoad function of the next view, simply because it fired off BEFORE the didSelectRowAtIndexPath of the calling view. I am using storyboard to link the views together. Both are UITableView. If I hit back and then reselect the table element it is then set, granted that by the time I hit back and then selected again, the variable got set. Is there any way to for the order of execution? I really don't want to do UI view switching on the back end. Any help is greatly appreciated!

    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

  • UIButton to intercept UITableView's didSelectRowAtIndexPath method

    - by Michael
    I've got a UIButton on a table cell that is meant to pop up a UIActionSheet but the problem is the didSelectRowAtIndexPath captures that touch and its action takes precedence. Any clever way to override that action when the user touches the button and still have the default action when the user presses elsewhere in the cell? Too bad there is no MoveToFront property.

    Read the article

  • Memory Allocation increases in didSelectRowAtIndexPath

    - by mongeta
    Hello, I'm testing my App and in a very simple view, each time a tap on a UITableView row, my allocation overall bytes get higher and higher and never go downs. I don't have any special code there, so I created a new project from scratch with a very simple view, force one section and just three rows. In the didSelectRowAtIndexPath code do nothing, and fire it with instruments and memory allocation and, the memory goes up with every cell selection ... Is this normal behaviour ? thanks, regards, m.

    Read the article

  • tableView:didSelectRowAtIndexPath: calls TTNavigator openURLAction:applyAnimated: — UITabBar and na

    - by vikingosegundo
    I have an existing iphone project with a UITabBar. Now I need styled text and in-text links to other ViewControllers in my app. I am trying to integrate TTStyledTextLabel. I have a FirstViewController:UITabelViewController with this tableView:didSelectRowAtIndexPath: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *url; if ([self.filteredQuestions count]>0) { url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [[self.filteredQuestions objectAtIndex:indexPath.row] id]]; [[TTNavigator navigator] openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } else { Question * q = [self.questions objectAtIndex:indexPath.row] ; url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [q.id intValue]]; } TTDPRINT(@"%@", url); TTNavigator *navigator = [TTNavigator navigator]; [navigator openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } My mapping looks like this: TTNavigator* navigator = [TTNavigator navigator]; navigator.window = window; navigator.supportsShakeToReload = YES; TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from:@"tt://question/(initWithQID:)" toViewController:[QuestionDetailViewController class]]; and my QuestionDetailViewController: @interface QuestionDetailViewController : UIViewController <UIScrollViewDelegate , QuestionDetailViewProtocol> { Question *question; } @property(nonatomic,retain) Question *question; -(id) initWithQID:(NSString *)qid; -(void) goBack:(id)sender; @end When I hit a cell, q QuestionDetailViewController will be called — but the navigationBar wont @implementation QuestionDetailViewController @synthesize question; -(id) initWithQID:(NSString *)qid { if (self = [super initWithNibName:@"QuestionDetailViewController" bundle:nil]) { //; TTDPRINT(@"%@", qid); NSManagedObjectContext *managedObjectContext = [(domainAppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext]; NSPredicate *predicate =[NSPredicate predicateWithFormat:@"id == %@", qid]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Question" inManagedObjectContext:managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; [request setPredicate:predicate]; NSError *error = nil; NSArray *array = [managedObjectContext executeFetchRequest:request error:&error]; if (error==nil && [array count]>0 ) { self.question = [array objectAtIndex:0]; } else { TTDPRINT(@"error: %@", array); } } return self; } - (void)viewDidLoad { [super viewDidLoad]; [TTStyleSheet setGlobalStyleSheet:[[[TextTestStyleSheet alloc] init] autorelease]]; [self.navigationController.navigationBar setTranslucent:YES]; NSArray *includedLinks = [self.question.answer.text vs_extractExternalLinks]; NSMutableDictionary *linksToTT = [[NSMutableDictionary alloc] init]; for (NSArray *a in includedLinks) { NSString *s = [a objectAtIndex:3]; if ([s hasPrefix:@"/answer/"] || [s hasPrefix:@"http://domain.com/answer/"] || [s hasPrefix:@"http://www.domain.com/answer/"]) { NSString *ttAdress = @"tt://question/"; NSArray *adressComps = [s pathComponents]; for (NSString *s in adressComps) { if ([s isEqualToString:@"qid"]) { ttAdress = [ttAdress stringByAppendingString:[adressComps objectAtIndex:[adressComps indexOfObject:s]+1]]; } } [linksToTT setObject:ttAdress forKey:s]; } } for (NSString *k in [linksToTT allKeys]) { self.question.answer.text = [self.question.answer.text stringByReplacingOccurrencesOfString:k withString: [linksToTT objectForKey:k]]; } TTStyledTextLabel *answerText = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(0, 0, 320, 700)] autorelease]; if (![[self.question.answer.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] hasPrefix:@"<div"]) { self.question.answer.text = [NSString stringWithFormat:@"%<div>%@</div>", self.question.answer.text]; } NSString * s = [NSString stringWithFormat:@"<div class=\"header\">%@</div>\n%@",self.question.title ,self.question.answer.text]; answerText.text = [TTStyledText textFromXHTML:s lineBreaks:YES URLs:YES]; answerText.contentInset = UIEdgeInsetsMake(20, 15, 20, 15); [answerText sizeToFit]; [self.navigationController setNavigationBarHidden:NO animated:YES]; [self.view addSubview:answerText]; [(UIScrollView *)self.view setContentSize:answerText.frame.size]; self.view.backgroundColor = [UIColor whiteColor]; [linksToTT release]; } ....... @end This works quite nice, as soon as a cell is touched, a QuestionDetailViewController is called and pushed — but the tabBar will disappear, and the navigationItem — I set it like this: self.navigationItem.title =@"back to first screen"; — won't be shown. And it just appears without animation. But if I press a link inside the TTStyledTextLabel the animation works, the navigationItem will be shown. How can I make the animation, the navigationItem and the tabBar be shown?

    Read the article

  • UITableViewCell is 1px shorter in didSelectRowAtIndexPath than cellForRowAtIndexPath

    - by Calvin L
    I have a UITableViewCell that I create in tableView:cellForRowAtIndexPath:. In that method I call: UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; NSLog(@"Cell height: %f", cell.contentView.frame.size.height); This gives me a return value of 44.000000. Then in my tableView:didSelectRowAtIndexPath: method, I call: UITableViewCell *cell = [tableView cellForRowAtIndexPath: indexPath]; NSLog(@"Cell height: %f", cell.contentView.frame.size.height); And this gives me a return value of 43.000000. Aren't they the same cell? What gives?

    Read the article

  • Enable editing does not call didSelectRowAtIndexPath ??

    - by elementsense
    Hi I have a UITableViewController where the user should be able to edit the items. In order to enable editing i use this : self.navigationItem.rightBarButtonItem = self.editButtonItem; And for everyone, how does not know where self.editButtonItem comes from, it is predefined by the SDK. So, now when I press on any item, this method is called : - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath but as soon as I hit the edit button and while editing is active, this method does not seemed to be called. Any idea what I missing ? This is the rest of the code that is related to editing : // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleNone; } - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO; } Thanks for the help. mcb

    Read the article

  • UIViewTableCell didSelectRowAtIndexPath is calling but not pushing a view controller

    - by Kenneth
    Hi guys, so im having a UIViewController view with a UITableView. So the UIViewController class name is SelectionScreen. The UITableView class name is SelectionScreenTable. Picture: http://img717.imageshack.us/i/screenshot20100609atpm0.png/ I have declared a UITableView *selectionTable in SelectionScreen class and connected it to the xib file of the SelectionScreen what the problem is , is that when i click a row in the table,it stays selected as highlighted blue, it calls the didSelectRowAtIndexPath (checked with NSLog) but not pushing a new view which is called(GraphView). This is the code which i use to call the new controller WHICH WORKS with a normal button GraphView *aSelectionScreenViewController = [[GraphView alloc] initWithNibName:@"GraphView" bundle:nil]; [self presentModalViewController:aSelectionScreenViewController animated: YES]; [aSelectionScreenViewController release]; I searched around and found that I need to set a delegate for the table in the UITableView class itself on the viewload tableview.delegate = self; or self.tableview.delegate = self; But it was not working. the controller was still not being pushed, and yes i have checked the controller is not nil as i tried it with a simple button. So i was thinking whether i should set the delegate of the UITableView at the UIViewController instead, so i tried this code selectionTable.delegate = selectionTable.self; but obviously it did not work =\, it messed up the whole UITableView and caused all the cells to be its predefined settings. So does anybody have any idea on how i can get it to work.

    Read the article

  • iPhone SDK: Why is didSelectRowAtIndexPath not being fired?

    - by iPhone Developer
    I have a view with a table on it. When the app starts, it loads the first 5 visble cells. That works as expected. My problem is that, when I try to scroll down in the table the app crashes with this error. What I've found is that didSelectRowAtIndexPath is not being called. AFAIK, all I need to do is to subscribe to the delegate. But I must be missing something? @interface LandingRetailersViewController : TableSectionHeaderViewController<UITableViewDataSource, UITableViewDelegate, UITabBarDelegate> { Any help appreciated. 2010-06-06 12:25:42.547 iphoneos[18238:207] * -[NSCFString tableView:cellForRowAtIndexPath:]: unrecognized selector sent to instance 0x451a980 2010-06-06 12:25:42.549 iphoneos[18238:207] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '** -[NSCFString tableView:cellForRowAtIndexPath:]: unrecognized selector sent to instance 0x451a980' Here is my code to load cells. UITableViewCell * cell = nil; NSInteger index = [indexPath indexAtPosition:1]; NSLog(@"WHAT IS INDEX %i", indexPath); RoundedGradientTableViewCell *retailerCell = (RoundedGradientTableViewCell *)[tb dequeueReusableCellWithIdentifier:@"RET"]; if(!retailerCell){ retailerCell = [[[RoundedGradientTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"RET"] autorelease]; } [retailerCell setArcSize:5.0]; [retailerCell setStrokeSize:1.0]; [retailerCell setStrokeColor:[UIColor clearColor]]; [retailerCell setBackgroundFillColor:[UIColor clearColor]]; [retailerCell setBackgroundColor:[UIColor clearColor]]; Retailer *retailer = [self retailerAtIndex:index]; if(retailer){ [[retailerCell textLabel] setText:[retailer name]]; if([retailer hasImage]){ [[retailerCell contentImageView] setImage:[retailer image]]; } } else { [[retailerCell textLabel] setText:@"No title"]; } cell = retailerCell; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; NSLog(@"retailer: %@ ", [retailer name]); NSLog(@"log: %i ", index); return cell;

    Read the article

  • iPhone: didSelectRowAtIndexPath not invoked

    - by soletan
    Hi, I know this issue being mentioned before, but resolutions there didn't apply. I'm having a UINavigationController with an embedded UITableViewController set up using IB. In IB the UITableView's delegate and dataSource are both set to my derivation of UITableViewController. This class has been added using XCode's templates for UITableViewController classes. There is no custom UITableViewCell and the table view is using default plain style with single title, only. Well, in simulator the list is rendered properly, with two elements provided by dataSource, so dataSource is linked properly. If I remove the outlet link for dataSource in IB, an empty table is rendered instead. As soon as I tap on one of these two items, it is flashing blue and the GDB encounters interruption in __forwarding__ in scope of a UITableView::_selectRowAtIndexPath. It's not reaching breakpoint set in my non-empty method didSelectRowIndexPath. I checked the arguments and method's name to exclude typos resulting in different selector. I recently didn't succeed in whether delegate is set properly, but as it is set equivalently to dataSource which is getting two elements from the same class, I expect it to be set properly. So, what's wrong? I'm running iPhone/iPad SDK 3.1.2 ... but tried with iPhone SDK 3.1 in simulator as well. EDIT: This is the code of my UITableViewController derivation: #import "LocalBrowserListController.h" #import "InstrumentDescriptor.h" @implementation LocalBrowserListController - (void)viewDidLoad { [super viewDidLoad]; [self listLocalInstruments]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)viewDidUnload { [super viewDidUnload]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [entries count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; if ( ( [entries count] > 0 ) && ( [indexPath length] > 0 ) ) cell.textLabel.text = [[[entries objectAtIndex:[indexPath indexAtPosition:[indexPath length] - 1]] label] retain]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if ( ( [entries count] > 0 ) && ( [indexPath length] > 0 ) ) { ... } } - (void)dealloc { [super dealloc]; } - (void) listLocalInstruments { NSMutableArray *result = [NSMutableArray arrayWithCapacity:10]; [result addObject:[InstrumentDescriptor descriptorOn:[[NSBundle mainBundle] pathForResource:@"example" ofType:@"idl"] withLabel:@"Default 1"]]; [result addObject:[InstrumentDescriptor descriptorOn:[[NSBundle mainBundle] pathForResource:@"example" ofType:@"xml"] withLabel:@"Default 2"]]; [entries release]; entries = [[NSArray alloc] initWithArray:result]; } @end

    Read the article

  • didSelectRowAtIndexPath TableView Popover Issue

    - by Jack Cody
    I've tried a lot of different code examples including just brute force try this try that but, stumped. The popover left arrow seems to display just fine if the first row is displayed at the very top of the table view but, when the table scrolls down the popover left arrow doesn't align correctly with the table row selected. Solutions or suggestions would be most appreciated. CGRect myFrame = [tableView rectForRowAtIndexPath:indexPath]; [self.editViewPopoverController setPopoverContentSize:CGSizeMake(320, 400)]; [self.editViewPopoverController presentPopoverFromRect:CGRectMake(myFrame.origin.x, myFrame.origin.y + offset, 400, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES]; Thanks.

    Read the article

  • iPhone SDK: selectRowAtIndexPath with delegate methods

    - by norskben
    Hi SO I am using selectRowAtIndexPath to select a tableview in the same ViewController class, but this does not run the delegate methods, eg: tableView:didSelectRowAtIndexPath I would like these delegate methods to also be called. Is there another API call I can be using? Thanks From the apple docs: selectRowAtIndexPath:animated:scrollPosition: Selects a row in the receiver identified by index path, optionally scrolling the row to a location in the receiver. - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor will it send UITableViewSelectionDidChangeNotification notifications to observers.

    Read the article

  • UINavigationController with UIView and UITableView

    - by Tobster
    I'm creating a navigation-based app which displays a graph, rendered with openGL, and a tableview listing disclosure buttons of all of the elements that are displayed on the graph, and a settings disclosure button. The navigation controller is also a tableview delegate and datasource, and the tableview is added to the view programatically and has its' delegate and datasource set to 'self'. The OpenGL based graph view is added via IB. The problem I'm having is that I'm trying to push a view controller (either settings or graph element properties) within the didSelectRowAtIndexPath method. The method registers and the new view is pushed on, but the tableview stays and obscures part of the view that was pushed on, as if it has a different navigation controller. I can't seem to set the tableview's navigation controller to be the same as the rest of the UINavigationControllers' view. Does anyone know how I could fix this? My navigation controllers' initWithCoder method, where the tableview is added, appears as follows: elementList = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStyleGrouped]; elementList.dataSource = self; elementList.delegate = self; [self.view addSubview:elementList]; Further in the source file, the DidSelectRowAtIndexPath method where the navigation controller is pushed appears as follows: Settings* Controller = [[Settings alloc] init]; [self pushViewController:Controller animated:YES]; [Controller release];

    Read the article

  • UIActivityIndicator on UITableViewCell not displaying while calling a webService

    - by Yoyi Cheika
    Hi coders, I guess my problem is very simple to solve but I haven been able to do so. Here is my problem: I have a custom table view cell that contains a UIActivityIndicator. When a cell is selected I push another view but this second view makes a call to a web service to bring data. Here is my code // Override to support row selection in the table view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here -- for example, create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController animated:YES]; // [anotherViewController release]; Models *models = [[Models alloc] initWithNibName:@"Models" bundle:nil]; models.make = ((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).make.text; models.year = (int)[self.yearLabel.text doubleValue]; models.logo = [makeLogosName objectAtIndex:indexPath.row]; [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator startAnimating]; [self.navigationController pushViewController:models animated:YES]; [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating]; [models release]; } Where MakeCell is my custom cell. If I comment this line [((MakeCell *)[tableView cellForRowAtIndexPath:indexPath]).activityIndicator stopAnimating]; then the indicator appears as expected when going back to the previous view. I feel like the indicator is not being visually updated until the didSelectRowAtIndexPath returns. Does is works ascyncronically. What can be my problem here. Thank you very much Cheika

    Read the article

  • Go back to main window once secondView is loaded

    - by Ruthy
    Hi, I have a Tableview on AppDelegate That calls a SecondView (dvController) when DidSelectRowAtIndexPath using: [self.window addSubview:[dvController view]]; On SecondView I defined a button linked to IBAction that should go back to previous view. It works great but when row selected but, How could then go back to previous view if main one is AppDelegate? self.window addSubview:[?? view]]; Should be basic concept but I am quite new and unable to get the solution. Thanx :)

    Read the article

  • How do you change the textLabel when UITableViewCell is selected?

    - by Ike
    I want to change the textLabel and detailTextLabel of a cell when it has been selected. I've tried the following, but no change occurs: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MyAppDelegate *appDelegate = (MyPhoneAppDelegate*)[[UIApplication sharedApplication] delegate]; UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; cell.detailTextLabel.text = @"xxxxx"; cell.textLabel.text = @"zzzzz"; [tableView reloadData]; }

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >