Search Results

Search found 442 results on 18 pages for 'nsindexpath'.

Page 11/18 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How to delete row in TTTableViewController (Three20)

    - by Dmitry
    Hi, The Three20 is great library. It's making the work with tables very easy. But one gap that I noticed - is deletion of rows, with animation. I spent many hours trying to do this, and this is what I'm doing: // get current index patch UITableView* table = [super tableView]; NSIndexPath *indexPath = [table indexPathForSelectedRow]; //delete row in data source TTListDataSource * source = (TTListDataSource *)self.dataSource; [source.items removeObjectAtIndex:indexPath.row]; // delete row from the table, with animation [table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; After this code runs the error appears: [NSCFArray objectAtIndex:]: index (0) beyond bounds (0) I'm using the class inherited from the TTTableViewController. And I doesn't implement the DataSourceDelegate or TableViewDelegate because I'm using the Three20 as much as possible. So, this is how I create datasource: for(NSDictionary *album in (NSArray *)albums){ TTTableRightImageItem *item = [TTTableRightImageItem itemWithText:@"name" imageURL:@"image url" defaultImage:nil imageStyle:TTSTYLE(rounded) URL:@"url of selector where I actually catch the tap on a row"]; [tableItems addObject:item]; } self.dataSource = [TTListDataSource dataSourceWithItems:tableItems]; I read this article (article) but it doesn't help :( So, I know that this is very simple for gurus from this site. Can you just give me advanced sample of how to do this Thanks

    Read the article

  • Getting data from UITableView

    - by Tejaswi Yerukalapudi
    Hi, I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this UIViewController - http://img189.imageshack.us/i/facilitycontroller.png/ Now, on clicking a button in the controller, I'd like to get the on/off status of all the UISwitches in the controller. Thanks, Teja Edit: I've made a few edits, but I still can't figure out how to do this. My program structure currently - A CustomCell.xib that looks like this - http://img11.imageshack.us/i/customfacilitiescell.png/ A CustomCellController that a subclass of UITableViewCell that has the IBOutlets for the labels and switches from above. Now I have a UIViewController<UITableViewDataSource, UITableViewDelegate> (Say, Screen1Controller) which looks like - http://img189.imageshack.us/i/facilitycontroller.png/ The tableviewcell is being created like this - - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *Id= @"CustomFacilitiesCell"; CustomFacilitiesCellController *cell = (CustomFacilitiesCellController *)[tableView dequeueReusableCellWithIdentifier:Id]; if(cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomFacilitiesCell" owner:self options:nil]; for (id oneObject in nib) { if([oneObject isKindOfClass:[CustomFacilitiesCellController class]]) cell = (CustomFacilitiesCellController *) oneObject; } } NSUInteger row = [indexPath row]; CustomFacilitiesCellController *rowData = (CustomFacilitiesCellController *)[self.facilities objectAtIndex:row]; cell.facname.text = rowData.facname.text; cell.FacID.text = rowData.FacID.text; cell.facSwitch = [(CustomFacilitiesCellController *)rowData facSwitch]; UISwitch *temp = cell.facSwitch; [(UISwitch *)[cell facSwitch] addTarget:self action:@selector(facSwitchOptionChanged:) forControlEvents:UIControlEventValueChanged]; cell.facSwitch.on = NO; //cell.facSwitch.enabled = FALSE; cell.accessoryType = UITableViewCellAccessoryNone; return cell; } - (IBAction) facSwitchOptionChanged:(id) sender { int i=0; } In particular, my problem is that the facSwitchOptionChanged() isn't getting called. Thanks again for the help, Teja.

    Read the article

  • Adding a modal view controller when I press a info button inside a tableviewCell

    - by gvalero87
    Hi, Here is a complex question, maybe it's not hard but there are many doubts i have. First let me give you what i have. This is the only place where i've gotten good answers. I have a table view controller with custom cells. In those cells i added a button (info dark one from IB) for each one of the cells. What i would like it's that when I press that button it displays a new view with more information about that cell, different of the view that i get from didSelectRowAtIndexPath. I've read a little bit about Modal View Controller and I think this is a case where I should use it. So here are my questions: How do i make a view controller a modal view controller?. I read that i have to have a delegate. Is there an example of how to create a normal modal view controller. I haven't been able to do so. How can this button know which cell is it from?. What i have right is a subclass tableviewcell with an IBOUTLET to this info button. This is not an important question because i guess i just could add a NSIndexPath attribute. I added an action in my tableviewsubclass that is triggered when the touchDown Event is called. I did this connection through IB. How can I call the modal view controller through here?, and is it even the right place to do this? Thanks

    Read the article

  • Iphone xCode - Navigation Controller on second xib view?

    - by Frames84
    Everything is fine, my navigation controller display's my 'Menu 1' item, but when i click it there appears to be a problem with the: [self.navigationController pushViewController:c animated:YES]; line it doesn't connect to the break point in the myClass file. so I think i've not joined something? but unsure what? my second view with the navigation controller doesn't have direct access to the AppDelegate so can't join it like i see in some tutorials. 1st view is just a button when clicked calls: [self presentModalViewController:mainViewController animated:YES]; my second View 'MainViewController' header looks like: @interface MainViewController :UITableViewController <UITableViewDelegate, UITableViewDataSource> { NSArray *controllers; UINavigationController *navController; } @property (nonatomic, retain) IBOutlet UINavigationController *navControllers; @property (nonatomic, retain) NSArray *controller; Then I have my MainViewController.m @synthesize controllers; @synthesize navController; - (void) viewDidLoad { NSMutableArray *array = [[NSMutaleArray alloc] init]; myClass *c = [[myClass alloc] initWithStyle:UITableViewStylePlain]; c.Title = @"Menu 1"; [array addObject:c]; self.Controllers = array; [array release]; } implemented numberOfRowsInSection and cellForRowAtIndexPath - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; myClass *c = [self.controllers objectAtIndex:row]; [self.navigationController pushViewController:c animated:YES]; // doesn't load myClass c // [self.navController pushViewController:c animated:YES]; } Also in interface designer I dragged a Navigation Controller onto my new XIB and changed the Root View Controller class to MainViewController and also connected the File Owner connector to the Navigation Controller to connect the navController Outlet. Thanks for you time.

    Read the article

  • UIButton in UITableViewCell events not working

    - by Tristan
    I see this problem all over the net, and none of the solutions listed work for me! I have added UIButton to a UITableViewCell in IB. I have assigned a custom UITableViewCell class to the UITableViewCell. My custom UITableViewCell class has an IBAction that im connecting to the Touch Up Inside event (I have tried other events they all don't work) but the IBAction function is never called! There is nothing else in the UITableViewCell, I have added the UIButton directly into the Content View. And everything has user interaction enabled! It is as simple as that I have nothing complex going on! What is is about a UITableViewCell that stops buttons working? EDIT: By request the code where I initialize my UITableViewCells the custom class is called DownloadCell - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"DownloadCell"; DownloadCell *cell = (DownloadCell *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { UIViewController * cellController = [[UIViewController alloc] initWithNibName:@"DownloadCell" bundle:nil]; cell = (DownloadCell *)cellController.view; [cellController release]; } SoundLibrarianIPhoneAppDelegate * del = (SoundLibrarianIPhoneAppDelegate *)[UIApplication sharedApplication].delegate; DownloadQueue * dq = del.downloadQueue; DownloadJob * job = [dq getDownloadJob: indexPath.row]; [job setDelegate:self]; SoundInfo * info = [job sound]; NSArray * seperated = [info.fileName componentsSeparatedByString: @"."]; NSString * displayName = [seperated objectAtIndex:0]; displayName = [displayName stringByReplacingOccurrencesOfString:@"_" withString:@" "]; displayName = [displayName capitalizedString]; [cell.titleLabel setText: displayName]; cell.progressBar.progress = job.percentCompleted; [cell.progressLabel setText: [job getProgessText]]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.userInteractionEnabled = YES; [cell setDelegate:self]; return cell; }

    Read the article

  • UIActionSheet not responding to touches

    - by mongeta
    Hello, I can't touch any button in my UIActionSheet. If I copy/paste this code in a new project, it works as expected. I'm forcing the First Responder = doesn't work I'm using [menu showFromTabBar:self.tabBarController.tabBar]; = doesn't work I'm using [menu showInView:self.view.window]; = doesn't work UIActivityIndicatorView *progressView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(150, 105, 25, 25)]; progressView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"first_time_loading" delegate:self cancelButtonTitle:@"device_stop_info" destructiveButtonTitle:nil otherButtonTitles:nil]; [menu addSubview:progressView]; [menu setTag:9]; [menu becomeFirstResponder]; [menu showInView:self.view]; // [menu becomeFirstResponder]; [menu setBounds:CGRectMake(0,0,320, 175)]; [progressView startAnimating]; [progressView hidesWhenStopped]; [menu becomeFirstResponder]; Don't know where to look for more ideas ... I'm opening from a UITableViewController in: - (void)viewDidAppear:(BOOL)animated { // doesn't work -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath // doesn't work thanks, r.

    Read the article

  • iPhone Device 3.1 SDK Breaks vertical alignment of UITableViewCellStyleValue1 textLabel

    - by user171089
    Can anyone provide an explanation for the following phenomenon? As of the iPhone Device 3.1 SDK, I've found that if a UITableViewCell is of style UITableViewCellStyleValue1 and its detailTextLabel.text is unassigned, then the textLabel does not display in the center of the cell as would be expected. One notable caveat is that this only happens for me when I'm testing on the Device – the iPhone Simulator 3.1 SDK displays the cells correctly. Also, this is not a problem when using the iPhone Device 3.0 SDK. Below is a simple UITableView subclass implementation that demonstrates the problem. @implementation BuggyTableViewController #pragma mark Table view methods // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; } switch (indexPath.row) { case 0: cell.textLabel.text = @"detailTextLabel.text unassigned"; break; case 1: cell.textLabel.text = @"detailTextLabel.text = @\"\""; cell.detailTextLabel.text = @""; break; case 2: cell.textLabel.text = @"detailTextLabel.text = @\"A\""; cell.detailTextLabel.text = @"A"; break; default: break; } return cell; } @end

    Read the article

  • UIWebView not loading URL when URL is passed from UITableView

    - by Mark Hazlett
    Hey Everyone, So i'm building a webView into my application to show the contents of a URL that I am passing from a selection in a UITableView. I know the UIWebView is loading content properly because if you hard code say http://www.google.ca into the NSURL then it loads fine, however when I'm passing the URL that I parsed from an RSS feed back from the UITableView it won't load the URL properly. I tried the debugger and the URL is coming out as nil right before I try and parse it, however I can use NSLog to print the value of it out to the console. here's the code in my UIViewController that has my UIWebView #import <UIKit/UIKit.h> @interface ReadFeedWebViewController : UIViewController { NSString *urlToGet; IBOutlet UIWebView *webView; } @property(nonatomic, retain) IBOutlet UIWebView *webView; @property(nonatomic, retain) NSString *urlToGet; @end Here's the code for my implementation's viewDidLoad method... // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"Url inside Web View Controller - %@", urlToGet); NSURL *url = [NSURL URLWithString:urlToGet]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [self.webView loadRequest:requestObj]; } Once again, I can print the URL to NSLog fine and if I hard code the URL into the NSURL object then it will load fine in the UIWebView. Here is where I'm setting the value in my UITableViewController... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ReadFeedWebViewController *extendedView = [[ReadFeedWebViewController alloc] init]; int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; extendedView.urlToGet = [[stories objectAtIndex: storyIndex] objectForKey:@"link"]; //NSLog([[stories objectAtIndex: storyIndex] objectForKey:@"summary"]); NSLog([[stories objectAtIndex: storyIndex] objectForKey:@"link"]); [self.navigationController pushViewController:extendedView animated:YES]; [extendedView release]; } However, since I can print the value using NSLog in the extendedView view controller I know it's being passed properly. Cheers

    Read the article

  • UIViewerTableViewController.m:15: error: expected identifier before '*' token

    - by Aaron Levin
    I am new to objective-c programming. I come from a C# background. I am having problems with the following code I am writing for a proof of concept for an iPhone App: I am getting a number of compile errors but I think they are all due to the first error (could be wrong) - error: expected identifier before '*' token (@synthesize *lists; in the .m file) I'm not sure why my code is showing up the way it is in the view below the editor..hmm any way, any help would be appreciated. .m file // // Created by Aaron Levin on 4/19/10. // Copyright 2010 RonStan. All rights reserved. // import "UIViewerTableViewController.h" @implementation UIViewerTableViewController @synthesize *lists; @synthesize *icon; (void)dealloc { [Lists release]; [super dealloc]; } pragma mark Table View Methods //Customize number of rows in table view (NSInteger)tableView:(UITableView *) tableView numberOfRowsInSection: (NSInteger) section{ return self.Lists.Count; } //Customize the appearence of table view cells (UITableViewCell *) tableView(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath{ static NSString *CellIdentifier = @"Cell"; UITableView *Cell = [tablevView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text = [[self.Lists objectAtIndex:indexPath.row] retain]; cell.imageView = self.Icon; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } @end .h file // // UIMyCardsTableViewController.h // MCS ProtoType v0.1 // // Created by Aaron Levin on 4/19/10. // Copyright 2010 RonStan. All rights reserved. // import @interface UIViewerTableViewController : UITableViewController { NSArray *lists; UIImage *icon; } @property (nonatomic,retain) NSArray *lists; @property (nonatomic,retain) UIImage *icon; @end

    Read the article

  • UITableView not reloading data on [self.tableView reloadData]

    - by donnib
    I have following code : - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; static NSString *RowListCellIdentifier = @"RowListCellIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RowListCellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RowListCellIdentifier]autorelease]; } NSMutableString *rowString = [[NSMutableString alloc] init]; [rowString appendString:[[[rows objectAtIndex:row] firstNumber]stringValue]]; [rowString appendString:@" : "]; [rowString appendString:[[[rows objectAtIndex:row] secondNumber]stringValue]]; [rowString appendString:@" : "]; [[cell textLabel] setText:rowString]; [rowString release]; return cell; } - (void)viewWillAppear:(BOOL)animated { [self.tableView reloadData]; [super viewWillAppear:animated]; } My problem is that the textLabel does not get reloaded with new data. If i log the rowString i see the correct value so data is good but in the UI it's the old data. I can see the cellForRowAtIndexPath beeing called so i know the reloadDatacall goes thru. What am i doing wrong ?

    Read the article

  • iPhone UITableView populateing from connectionDidFinishLoading

    - by fourfour
    Hey all. I have been trying for hours to figure this out. I have some JSON from a NSURLConnection. This is working fine and I have parsed it into an array. But I can't seem to get the array out of the connectionDidFinishLoading method. I an am getting (null) in the UITableViewCell method. I am assuming this is a scope of retain issue, but I am so new to ObjC I am not sure what to do. Any help would be greatly appreciated. Cheers. -(void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; [responseData release]; SBJSON *json = [[SBJSON alloc] init]; NSDictionary *results = [json objectWithString:responseString]; self.dataArray = [results objectForKey:@"data"]; NSMutableArray *tableArray = [[NSMutableArray alloc] initWithObjects:nil]; for (NSString *element in dataArray) { //NSLog(@"%@", [element objectForKey:@"name"]); NSString *tmpString = [[NSString alloc] initWithString:[element objectForKey:@"name"]]; [tableArray addObject:tmpString]; } } - (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]; } // Configure the cell. //cell.textLabel.text = [self.tableView objectAtIndex:indexPath.row]; cell.textLabel.text = [self.tableArray objectAtIndex:indexPath.row]; NSLog(@"%@", tableArray); return cell; }

    Read the article

  • UITableView scrolling to specific position

    - by Dave
    I am using iPhone SDK 3.1.3. I have a UITableViewController which gets data from another controller. The tableview is added as a subview to the mainview but the frame is set so that it is not visible. The tableview frame is updated and made to slide over the main view by tapping on a button. The table view appears and i scroll to the last row. if i select the last row, i reload the table with more data. The table gets updated with more data. everything works fine except the scroll position is always the top. I need the scroll position to be the last row that I clicked on to load more data. I save the scroll position and call the following code after it loads more data. It executes without issues but the scroll position is always the top. [theTableView scrollTRowAtIndexPath:[NSIndexPath indexPathForRow:savedScrollPosition inSection:0] atScrollPosition:savedScrollPosition animated:NO]; The above seems to have no effect. ViewWillAppear: ViewDidAppear: does not fire and I am told that if the view controller is instantiated in code, which is the case, these don't fire.

    Read the article

  • Shake based application

    - by Sid
    hii frnz, i am developing an application which deletes rows from a table view when the user shakes the iPhone.i have created a navigation based project. now when the user shakes the iPhone i want that the title of navigation bar should change to "DELETE" and a delete button should appear on the navigation bar on the same view (but this operation should take place only when the user shakes the iPhone )otherwise when a user selects a particular row then it should move to next view.I have written the followin code but its not working.plz help me out..... (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //NSLog(@"hiiiii"); if (isShaked == NO) { //logic to move to next view goes here. } else { self.title = @"Delete Rows"; delete=[[UIBarButtonItem alloc] initWithTitle:@"Delete rows" style: UIBarButtonItemStyleBordered target:self action:@selector(deleteItemsSelected)] ; self.navigationItem.rightBarButtonItem=self.delete; MyTableCell *targetCustomCell = (MyTableCell *)[tableView cellForRowAtIndexPath:indexPath]; [targetCustomCell checkAction]; [self.tempArray addObject: [myModal.listOfStates objectAtIndex:indexPath.row]]; //[delete addTarget:self action:@selector(deleteItemsSelected:) forControlEvents:UIControlEventTouchUpInside]; self.tempTableView = tableView; } } -(void)deleteItemsSelected { //for(int i = 0; i <= [tempArray count]; i++) //{ //} [myModal.listOfStates removeObjectsInArray:tempArray]; [tempTableView reloadData]; } checkAction method is a custom cell method which is used to put a tickmark on the row selected

    Read the article

  • Can't get Secondary UITableViewController to display inside a UITabBarController

    - by Paul Johnston
    I've programmatically created a UITabBarController that is loaded in my App Delegate like this: - (void)applicationDidFinishLaunching:(UIApplication *)application { tabBarController = [[UITabBarController alloc] init]; myTableViewController = [[MyTableViewController alloc] init]; UINavigationController *tableNavController = [[[UINavigationController alloc] initWithRootViewController:myTableViewController] autorelease]; myTableViewController.title = @"Tab 1"; [myTableViewController release]; mySecondTableViewController = [[MySecondTableViewController alloc] init]; UINavigationController *table2NavController = [[[UINavigationController alloc] initWithRootViewController:mySecondTableViewController] autorelease]; mySecondTableViewController.title = @"Tab 2"; [mySecondTableViewController release]; tabBarController.viewControllers = [NSArray arrayWithObjects:tableNavController, table2NavController, nil]; [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; } Now the issue I have is that I can get into the views no problem, but when I try and click onto any item in the Table View, I can't get a secondary table view to appear in any tab. The tabs work absolutely fine, just the secondary views. I'm using the code below in my myTableViewController to run when selecting a specific row (the code reaches the HELP line, and crashes)... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; // this gets the correct view controller from a list of controllers SecondaryViewController *svc = [self.controllers objectAtIndex:row]; /*** HELP NEEDED WITH THIS LINE ***/ [self.navigationController pushViewController:svc animated:YES]; } Simply put, I'm trying to switch views to the new view controller whilst keeping the tabs available and using the navigation to go back and forth (like in the iTunes App). Any help appreciated. Thanks

    Read the article

  • ASIHTTP: multi threads and multi UIPorgressView

    - by user262325
    Hello everyone I have a project to download multi files (fileurl). It display the each thread on a UITableView. In UITableView - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger row=[indexPath row]; NSInteger section=[indexPath section]; //UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"any-cell"]; static NSString *SimpleTableIdentifier1 = @"SimpleTableIdentifier1"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: SimpleTableIdentifier1] autorelease]; } UIProgressView *aUIProgressView; aUIProgressView =[[UIProgressView alloc] initWithFrame:CGRectMake( 10.9f,48.0f,300.0f,28.0f)]; [aUIProgressView setTag:row]; [aUIProgressView setProgress:0]; [cell addSubview:aUIProgressView]; [self startADownloadThread : [[downloadArray objectAtIndex:row] getURL] progressview:switchView ]; [aUIProgressView release]; [cell setText: [[downloadArray objectAtIndex:row] getURL]]; return cell; } It calls 'startADownloadThread' - (IBAction)startADownloadThread:(NSString *)fileurl progressview:(UIProgressView *)a { [a setProgress:0]; NSLog(@"Value: %f", [a progress]); [networkQueue cancelAllOperations]; [networkQueue setDownloadProgressDelegate:a]; [networkQueue setDelegate:self]; [networkQueue setRequestDidFinishSelector:@selector(requestDone:)]; [networkQueue setShowAccurateProgress:true]; NSURL *url = [NSURL URLWithString:fileurl]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; [networkQueue addOperation:request]; [networkQueue go]; } I hope each aUIProgressView display the download progress of each download thread. The above source codes : Display the aUIProgressView list correctly, but only the last aUIProgressView link to a thread display the correct progress, others' value are 0 Welcome any comment Thanks interdev

    Read the article

  • UISearchDisplayController "shouldReloadTableForSearchString return NO" reloads table

    - by Jeena
    Why does my UISearchDisplayController show "No results" even if the shouldReloadTableForSearchString method returns NO? Shouldn't it just do nothing and stay black? How can I prevent it from doing so? #import "RootViewController.h" #pragma mark Table view methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == self.searchDisplayController.searchResultsTableView) { return 0; } return 10; } // Customize the appearance of table view cells. - (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]; } // Configure the cell. cell.textLabel.text = [NSString stringWithFormat:@"row %d", indexPath.row]; return cell; } #pragma mark SearchController stuff - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { return NO; } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • Speed Problem - Animating Height Change in UITableView

    - by Travis
    So I have a huge UITableView, between 1000 and 3000 rows. Each row needs to, when selected, expand to include several buttons. I do this by rendering the buttons below the cell, enabling clipping on the cells, and then just animating a change in height when they're selected. So I have heightForRowAtIndex checking if the row is selected, if so it gives a different height value. To do the animation, I have the following: - (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { [self.tableView beginUpdates]; [self.tableView endUpdates]; } This all works wonderfully until I get around 1000 rows, at which point the animations still work and are still quite smooth, but they lag by a second or two. My first thought was a memory problem, but everything is being autoreleased and upon inspection my application isn't even receiving a memory warning message. So...any ideas on what this might be and how I can erase this lag between selection and change in cell height? Oh, and one last thing - right now I'm testing this on the iPad, so if this is a problem there, I expect it to be worse on our other target devices (iPhone and iPod).

    Read the article

  • UITableViewCell background size

    - by quano
    I'm trying to set the size of my background to be a little shorter than the default, creating some space between the cells. This has proven to be difficult. Setting the frame of the background view seems to do nothing: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *reuseIdentifier = @"cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; if (!cell) cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:reuseIdentifier] autorelease]; // Set up the cell... cell.contentView.backgroundColor = [UIColor clearColor]; cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectMake(0, 4, 320, 42)] autorelease]; cell.backgroundView.backgroundColor = [UIColor blackColor]; cell.backgroundView.alpha = .2; cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectMake(0, 4, 320, 42)] autorelease]; cell.selectedBackgroundView.backgroundColor = [UIColor whiteColor]; cell.selectedBackgroundView.alpha = .2; cell.font = [UIFont fontWithName:@"MarkerFelt-Thin" size:22.0f]; cell.selectedTextColor = [UIColor blackColor]; cell.textColor = [UIColor whiteColor]; NSDictionary *dict = [files objectAtIndex:indexPath.row]; cell.text = [dict objectForKey:@"name"]; return cell; } Any help? Also, setting the selected background view doesn't do anything. When a cell is selected, the background is completely blank. Why is this? I'm using iPhone OS 2.2.1. I also do this: - (void)viewDidLoad { [super viewDidLoad]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.rowHeight = 50.0f; } You can download the code here (made a small project for this issue only): http://dl.dropbox.com/u/608462/tabletest2.zip

    Read the article

  • Design patter to keep track UITableView rows correspondance to underlying data in constant time.

    - by DenNukem
    When my model changes I want to animate changes in UITableView by inserting/deleting rows. For that I need to know the ordinal of the given row (so I can construct NSIndexPath), which I find hard to do in better-than-linear time. For example, consider that I have a list of addressbook entries which are manualy sorted by the user, i.e. there is no ordering "key" that represents the sort order. There is also a corresponding UITableView that shows one row per addressbook entry. When UITableView queries the datasource I query the NSMUtableArray populated with my entries and return required data in constant time for each row. However, if there is a change in underlying model I am getting a notification "Joe Smith, id#123 has been removed". Now I have a dilemma. A naive approach would be to scan the array, determine the index at which Joe Smith is and then ask UITableView to remove that precise row from the view, also removing it form the array. However, the scan will take linear time to finish. Now I could have an NSDictionary which allows me to find Joe Smith in constant time, but that doesn't do me a lot of good because I still need to find his ordinal index within the array in order to instruct UITableView to remove that row, which is again a linear search. I could further decide to store each object's ordinal inside the object itself to make it constant, but it will become outdated after first such update as all subsequent index values will have changed due to removal of an object. So what is the correct design pattern to accurately reflect model changes in the UITableView in costant (or at least logarithmic) time?

    Read the article

  • How to resize image to fit UITableView cell?

    - by stefanB
    How to fit UIImage into the cell of UITableView, UITableViewCell (?). Do you addSubview to cell or is there a way to resize cell.image or the UIImage before it is assigned to cell.image ? I want to keep the cell size default (whatever it is when you init with zero rectangle) and would like to add icon like pictures to each entry. Images are slightly bigger than the cell size (table row size). I think the code looks like this (from top of my head): UIImage * image = [[UIImage alloc] imageWithName:@"bart.jpg"]; cell = ... dequeue cell in UITableView data source (UITableViewController ...) cell.text = @"bart"; cell.image = image; What do I need to do to resize the image to fit the cell size? I've seen something like: UIImageView * iview = [[UIImageView alloc] initWithImage:image]; iview.frame = CGRectMake(...); // or something similar [cell.contentView addSubview:iview] The above will add image to cell and I can calculate the size to fit it, however: I'm not sure if there is a better way, isn't it too much overhead to add UIImageView just to resize the cell.image ? Now my label (cell.text) needs to be moved as it is obscured by image, I've seen a solution where you just add the text as a label: Example: UILabel * text = [[UILable alloc] init]; text.text = @"bart"; [cell.contentView addSubview:iview]; [cell.contentView addSubview:label]; // not sure if this will position the text next to the label // edited original example had [cell addSubview:label], maybe that's the problem Could someone point me in correct direction? EDIT: Doh [cell.contentview addSubview:view] not [cell addSubview:view] maybe I'm supposed to look at this: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = ...; CGRect frame = cell.contentView.bounds; UILabel *myLabel = [[UILabel alloc] initWithFrame:frame]; myLabel.text = ...; [cell.contentView addSubview:myLabel]; [myLabel release]; }

    Read the article

  • How do I add a button to my navigationController's right side after pushing another view controller

    - by bobobobo
    So, immediately after pushing a view controller to my tableView, // 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]; Ok, so that makes another view slide on, and you can go back to the previous view ("pop" the current view) by clicking the button that automatically appears in the top left corner of the navigation bar now. Ok, so SAY I want to populate the RIGHT SIDE of the navigation bar with a DONE button, like in the "Notes" app that comes with the iPhone. How would I do that? I tried code like this: UIBarButtonItem * doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector( doneFunc ) ]; self.navigationController.navigationItem.rightBarButtonItem = doneButton ; // not it.. [doneButton release] ; doneFunc is defined, and everything, just the button never appears on the right side..

    Read the article

  • iPhone:How to set background image for tablerow cell?

    - by user187532
    Hello all, I want to put some background image for TableView row cell. I am using the following code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ..................... ................... UIImage * backgroundImage = [UIImage imageNamed:@"cell.png"]; UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage]; cell.opaque = NO; cell.contentView.opaque = NO; cell.backgroundColor = [UIColor clearColor]; cell.backgroundColor = backgroundColor; //cell.contentView.backgroundColor = [UIColor clearColor]; //cell.contentView.backgroundColor = backgroundColor; } But it is not giving the background image properly. Could someone guide me what is the proper ways of setting background image for a tableview row? Note: I'm also setting background image for my TableView as well using the below code: UIImage * backgroundImage = [UIImage imageNamed:@"Tablebackground.png"]; UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage]; self.myTableView.backgroundColor = [UIColor clearColor]; self.myTableView.alpha = 0.9; self.myTableView.backgroundColor = backgroundColor; I don't observe any problem for tableview background. Only thing here is, tableview background image is not being static, when scrolling happening, image is also scrolling. But i want to know first how to set background image for Tableview row cell? Thank you.

    Read the article

  • Custom UITableViewCell with 2 UILabel's resized

    - by petert
    I'm struggling to create a custom UITableViewCell (in IB) that has a UIImageView on the left, fixed to the top left corner, then 2 UILabel's adjacent to it, side by side. So the cell looks something like: +---------------------------+ | IMAGE LABEL1 LABEL2 > | +---------------------------+ What I cannot seem to do is to change the frame of LABEL1 so it fits the text is contains, then make sure LABEL2 moves to the left (or right) so it ends up directly adjacent to it, filling all the space for the rest of the cell. So, concentrating on the label text, I'd like cell to look like this: +---------------------------+ | IMAGE Call 123456 > | +---------------------------+ after I've set LABEL1 to "Call" and LABEL2 to "123456" in: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath Actually I can resize LABEL1 with this: CGSize sizeToMakeLabel = [label.text sizeWithFont:label.font]; label.frame = CGRectMake(label.frame.origin.x, label.frame.origin.y, sizeToMakeLabel.width + 3, sizeToMakeLabel.height); Now the frame for the text "Call" fits this text (confirmed by setting a background color), but the text "123456" doesn't seem to shift to the left, whatever autosizing I set in IB, or methods to resize the cells view? I seem to need the +3 to make sure "Call" didn't look like this "C…" also? I'm using 2 labels so LABEL1 can be in a bold font say.

    Read the article

  • iPhone SDK: PushViewController not working

    - by iPhone Developer
    I am trying to create a basic navigation application with a header and detail screen. My problem is the detail screen is not working. The code below is for the opening the detail view and placing it on the nav stack. My problem is the detail screen is not being pushed and I'm not sure why? I have verified the method below is firing. Any ptr or links to examples appreciated. //this opens up a detail view -(void) tableView:(UITableView *)tb didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"DETAIL VIEW....."); NSInteger index = [indexPath indexAtPosition:1]; Retailer *retailer = [self retailerAtIndex:index]; if(retailer) { NSLog(@"DETAIL VIEW helelelelekjekljklerj....."); Membership * newMem = [[Membership alloc] init]; [newMem setIssuerId:[retailer retailerId]]; MembershipViewController * mvc = [[MembershipViewController alloc] initWithNibName:nil bundle:nil]; [mvc setSubject:newMem]; RootAppDelegate *appDelegate = (RootAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate.landingRetailersNavController pushViewController:mvc animated:YES]; [mvc release]; [newMem release]; }

    Read the article

  • NSMutableArray to NSString and Passing NSString to Another View IOS5.1

    - by Space Dust
    I have an NSMutableArray of names. I want the pass the data (selected name) inside of NSMutableArray as text to another view's label. FriendsController.m: - (void)viewDidLoad { [super viewDidLoad]; arrayOfNames=[[NSMutableArray alloc] init]; arrayOfIDs=[[NSMutableArray alloc] init]; userName=[[NSString alloc] init]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { long long fbid = [[arrayOfIDs objectAtIndex:indexPath.row]longLongValue]; NSString *user=[NSString stringWithFormat:@"%llu/picture",fbid]; [facebook requestWithGraphPath:user andDelegate:self]; userName=[NSString stringWithFormat:@"%@",[arrayOfNames objectAtIndex:indexPath.row]]; FriendDetail *profileDetailName = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; profileDetailName.nameString=userName; [profileDetailName release]; } - (void)request:(FBRequest *)request didLoad:(id)result { if ([result isKindOfClass:[NSData class]]) { transferImage = [[UIImage alloc] initWithData: result]; FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; [profileDetailPicture view]; profileDetailPicture.profileImage.image= transferImage; profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:profileDetailPicture animated:YES]; [profileDetailPicture release]; } } In FriendDetail.h NSString nameString; IBOutlet UILabel *profileName; @property (nonatomic, retain) UILabel *profileName; @property (nonatomic, retain) NSString *nameString; In FriendDetail.m - (void)viewDidLoad { [super viewDidLoad]; profileName.text=nameString; } nameString in second controller(FriendDetail) returns nil. When i set a breakpoint in firstcontroller I see the string inside of nameString is correct but after that it returns to nil somehow.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >