Search Results

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

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

  • Working through exercises in "Cocoa Programming for Mac OS X" - I'm stumped

    - by Zigrivers
    I've been working through the exercises in a book recommended here on stackoverflow, however I've run into a problem and after three days of banging my head on the wall, I think I need some help. I'm working through the "Speakline" exercise where we add a TableView to the interface and the table will display the "voices" that you can choose for the text to speech aspect of the program. I am having two problems that I can't seem to get to the bottom of: I get the following error: * Illegal NSTableView data source (). Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row: The tableView that is supposed to display the voices comes up blank I have a feeling that both of these problems are related. I'm including my interface code here: #import <Cocoa/Cocoa.h> @interface AppController : NSObject <NSSpeechSynthesizerDelegate, NSTableViewDelegate> { IBOutlet NSTextField *textField; NSSpeechSynthesizer *speechSynth; IBOutlet NSButton *stopButton; IBOutlet NSButton *startButton; IBOutlet NSTableView *tableView; NSArray *voiceList; } - (IBAction)sayIt:(id)sender; - (IBAction)stopIt:(id)sender; @end And my implementation code here: #import "AppController.h" @implementation AppController - (id)init { [super init]; //Log to help me understand what is happening NSLog(@"init"); speechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil]; [speechSynth setDelegate:self]; voiceList = [[NSSpeechSynthesizer availableVoices] retain]; return self; } - (IBAction)sayIt:(id)sender { NSString *string = [[textField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; //Is the string zero-length? if([string length] == 0) { NSLog(@"String from %@ is a string with a length of %d.", textField, [string length]); [speechSynth startSpeakingString:@"Please enter a phrase first."]; } [speechSynth startSpeakingString:string]; NSLog(@"Started to say: %@", string); [stopButton setEnabled:YES]; [startButton setEnabled:NO]; } - (IBAction)stopIt:(id)sender { NSLog(@"Stopping..."); [speechSynth stopSpeaking]; } - (void) speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL)complete { NSLog(@"Complete = %d", complete); [stopButton setEnabled:NO]; [startButton setEnabled:YES]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { return [voiceList count]; } - (id)tableView: (NSTableView *)tv objecValueForTableColumn: (NSTableColumn *)tableColumn row:(NSInteger)row { NSString *v = [voiceList objectAtIndex:row]; NSLog(@"v = %@",v); NSDictionary *dict = [NSSpeechSynthesizer attributesForVoice:v]; return [dict objectForKey:NSVoiceName]; } /* - (BOOL)respondsToSelector:(SEL)aSelector { NSString *methodName = NSStringFromSelector(aSelector); NSLog(@"respondsToSelector: %@", methodName); return [super respondsToSelector:aSelector]; } */ @end Hopefully, you guys can see something obvious that I've missed. Thank you!

    Read the article

  • I want to get the value from one class (SearchTableViewController.m) to another class (HistoryTableV

    - by ahmet732
    #import <UIKit/UIKit.h> @class SearchDetailViewController; @interface SearchTableViewController : UITableViewController <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>{ IBOutlet UITableView *myTableView; NSMutableArray *tableData;//will be storing data that will be displayed in table. //Search array den buna aktarma yapcaz ilerde görceksin. NSMutableArray *searchedData;//will be storing data matching with the search string UISearchBar *sBar;//search bar NSMutableArray *searchArray; // It holds the medicines that are shown in tableview SearchDetailViewController * searchDetailViewController; NSMutableArray *deneme; } @property(nonatomic,retain)UISearchBar *sBar; @property(nonatomic,retain)IBOutlet UITableView *myTableView; @property(nonatomic,retain)NSMutableArray *tableData; @property(nonatomic,retain)NSMutableArray *searchedData; @property (nonatomic, retain) NSMutableArray *searchArray; @property (nonatomic, retain) SearchDetailViewController *searchDetailViewController; @property (nonatomic, copy) NSMutableArray *deneme; @end SearchTableViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController]; // [anotherViewController release]; **deneme= [[NSMutableArray alloc]init]; deneme=[tableData objectAtIndex:indexPath.row];** ****NSLog(@"my row = %@", deneme);**// I holded one of the selected cells here** HistoryTableViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController]; // [anotherViewController release]; **SearchTableViewController *obj= [[SearchTableViewController alloc]init];** **NSLog(@"my 2nd row= %@", [obj deneme]); //it prints nil** } My project is TabBar. There are two buttons on it- Search and History. I want to display selected items in a table in History tab. But i can not bring the selected item from SearchTableViewController.m to the class (HistoryTableViewController.m) The problem is : I can hold one of the selected items in an array (named deneme)from table in SearchTableViewController.m but i can not take it to HistoryTableViewController.m. It prints nil in console screen.... If I can make it visible in History class, I display those selected items on table. Please help me !!!

    Read the article

  • Issues declaring already existing NSMutableArray in new class

    - by Graeme
    I have a class (DataImporter) which has the code to download an RSS feed. I also have a view and separate class (TableView) which displays the data in a UITableView and starts the parsing process, storing parsed information in an NSMutableArray (items) which is located in the (TableView) subclass. Now I wish to add a UIMapView which displays the items in the (items) NSMutableArray. Herein lies the issue - I need to somehow get the data from the (items) NSMutableArray into the new (mapView) subclass which I'm struggling with - and I preferably don't want to have to create a new class to download the data again for the mapView class when it already is in the applications memory. Is there a way I can transfer the information from the NSMutableArray (items) class to the (mapView) class (i.e. how do I declare the NSMutableArray in the (mapView) class)? Here's a overview of how the system works: App opened Data downloaded (using DataImporter class) when (TableView) viewDidLoad runs Data stored in NSMutableArray accessible by the (TableView) class And from here I need to access and declare the array from a new (mapView) class. Any help greatly appreciated, thanks. Code for viewDidLoad MapKit: Data *data = nil; NSString *ilocation = [data locations]; NSString *ilocation2 = @"New Zealand"; NSString *inewlString; inewlString = [ilocation stringByAppendingString:ilocation2]; NSLog(@"inewlString=%@",inewlString); if(forwardGeocoder == nil) { forwardGeocoder = [[BSForwardGeocoder alloc] initWithDelegate:self]; } // Forward geocode! [forwardGeocoder findLocation: inewlString]; Code for parsing data into original NSMutable Array: - (void)beginParsing { NSLog(@"Parsing has begun"); //self.navigationItem.rightBarButtonItem.enabled = NO; // Allocate the array for song storage, or empty the results of previous parses if (incidents == nil) { NSLog(@"Grabbing array"); self.datas = [NSMutableArray array]; } else { [datas removeAllObjects]; [self.tableView reloadData]; } // Create the parser, set its delegate, and start it. self.parser = [[DataImporter alloc] init]; parser.delegate = self; [parser start]; }

    Read the article

  • In an iPad SplitView, how do I add a Date Picker control to the Root View?

    - by Dr Dork
    I'm diving into iPhone OS development on the iPad and one of the things I'm playing with is the SplitView template. The template provides a window with a UISplitView view, containing the Root View (on the left of the window) and the Detail View (on the right of the window). The Root View is a subclass of a TableView. Rather than having the entire Root View consist of a TableView, I'd like it to contain a DatePicker view along with the TableView under it. When I go into IB and try and drop a DatePicker into the Root View, it won't let me. It will only let me add a DatePicker view to the Detail View. Why wont IB let me drop a DatePicker view into the Root View? How can I add a DatePicker to the RootView in addition to the TableView? I'm still learning this new platform, so I apologize if these questions are absurd in any way. Thanks so much in advance for your help, I'm going to continue researching these questions right now.

    Read the article

  • In the Xcode SplitView template for an iPad app, how do I add a Date Picker control to the Root View

    - by Dr Dork
    I'm diving into iPhone OS development on the iPad and one of the things I'm playing with is the SplitView template. The template provides a window with a UISplitView view, containing the Root View (on the left of the window) and the Detail View (on the right of the window). The Root View is a subclass of a TableView. Rather than having the entire Root View consist of a TableView, I'd like it to contain a DatePicker view along with the TableView under it. When I go into IB and try and drop a DatePicker into the Root View, it won't let me. It will only let me add a DatePicker view to the Detail View. Why wont IB let me drop a DatePicker view into the Root View? How can I add a DatePicker to the RootView in addition to the TableView? I'm still learning this new platform, so I apologize if these questions are absurd in any way. Thanks so much in advance for your help, I'm going to continue researching these questions right now.

    Read the article

  • addSubview insertSubview aboveSubview bit confused as to why it does not work

    - by John Smith
    I'm a bit confused all as to why the belowSubview does not work. I'm adding some (subviews) to my navigationController and all of that works well. -(UITableView *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ... ... [self.navigationController.view addSubview:ImageView]; [self.navigationController.view addSubview:toolbar]; add some point in my app I wish to add another toolbar or image above my toolbar. so let's say I'm doing something like this -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... ... [self.navigationController.view insertSubview:NewImageView aboveSubview:toolbar]; //crucial of course [edit] rvController = [RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle] mainBundle]; rvController.CurrentLevel += 1; rvController.CurrentTitle = [dictionary objectForKey:@"Title"]; [self.navigationController pushViewController:rvController animated:YES]; rvController.tableDataSource = Children; [rvController release]; However this doesn't work.. Does anyone know what I'm doing wrong here ... Should I have used something else instead of addSubview or is the problem somewhere else?

    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

  • 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

  • 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

  • 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

  • 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

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

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

    Read the article

  • Toolbar hiding on rotated UISplitView DetailView

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

    Read the article

  • UITableView: Header below a section gets duplicated if a row is deleted from the section above

    - by Megasaur
    In the editing mode of one of my tableviews, I delete a row from a section. The section below has a header. The deletion of the row in the section above leads to duplication of the section header below. So I have 2 header titles, one above the other. I also tried forcing a reload of the section after the delete to no avail: [self.tableView beginUpdates]; [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; NSIndexSet * indexSet = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(3,1)]; [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade]; [indexSet release]; [self.tableView endUpdates]; Any ideas of what I have done wrong? It is also interesting that the header that failed to get removed is not "seen". If I scroll right off the content of the table view, and let it snap back, only the top header view is seen. It always ignores the header that should have been removed.

    Read the article

  • populate UITableView from json

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

    Read the article

  • 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

  • NSTableView Drag and Drop not working

    - by macatomy
    Hi, I'm trying to set up very basic drag and drop for my NSTableView. The table view has a single column (with a custom cell). The column is bound to an NSArrayController, and the array controller's content array is bound to an NSArray on my controller object. The data displays fine in the table. I connected the dataSource and delegate outlets of the table view to my controller object, and then implemented these methods: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { NSLog(@"dragging"); return YES; } - (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)op { return NSDragOperationEvery; } - (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { return YES; } I also registered the drag types in -awakeFromNib: #define MyDragType @"MyDragType" - (void)awakeFromNib { [super awakeFromNib]; [_myTable registerForDraggedTypes:[NSArray arrayWithObjects:MyDragType, nil]]; } The problem is that the -tableView:writeRowsWithIndexes:toPasteboard: method is never called. I've looked at a bunch of examples and I can't figure out anything I'm doing wrong. Could the problem be that I'm using a custom cell? Is there something I'm supposed to override in the cell subclass to enable this functionality? EDIT: Confirmed. Switching the custom cell for a regular NSTextFieldCell made dragging work. Now, how do I make drag and drop work with my custom cell?

    Read the article

  • Pushing to a UITable inside a UIView from a UITableview

    - by Michael Robinson
    I can firgure out how to push a UIView from a Tableview and have the "child" details appear. Here is the view I'm trying to load: Here is the code that checks for children and either pushes a itemDetail.xib or an additional UITable, I want to use the above .xib but load the correct contents "tableDataSource" into the UItable: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Get the dictionary of the selected data source. NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row]; //Get the children of the present item. NSArray *Children = [dictionary objectForKey:@"Children"]; if([Children count] == 0) { ItemDetailViewController *dvController = [[ItemDetailViewController alloc] initWithNibName:@"ItemDetailView" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; } else { //Prepare to tableview. FirstTab *rvController = [[FirstTab alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]]; //Increment the Current View rvController.CurrentLevel += 1; //Set the title; rvController.CurrentTitle = [dictionary objectForKey:@"Title"]; //Push the new table view on the stack [self.navigationController pushViewController:rvController animated:YES]; rvController.tableDataSource = Children; [rvController release]; } } Thanks for the help. I see lots of stuff on this but can't find the correct push instructions.

    Read the article

  • How do I change the CellErrorStyle for an Xceed Datagrid?

    - by Bob
    So in the Xceed documentation there is a code example that does not work for me. It may be because my grid is bound to a DataGridCollectionView. The objects in the collection used by the datagridcollection are what implement IDataErrorInfo. The errors are showing up just fine. The problem is that they are using the default orange background for errors...I need a red border. Below is the XAML instantiation of my grid. I set the DataCell background property to red just so I could be sure I had access to the grid's properties... I do. I just can't find the way to identify the cell's w/ errors so I can style them. Thanks! <XceedDG:DataGridControl Grid.Row="1" Grid.ColumnSpan="5" ItemsSource="{Binding Path = ABGDataGridCollectionView, UpdateSourceTrigger=PropertyChanged}" Background="{x:Static Views:DataGridControlBackgroundBrushes.ElementalBlue}" IsDeleteCommandEnabled="True" FontSize="16" AutoCreateColumns="False" x:Name="EncounterDataGrid" AllowDrop="True"> <XceedDG:DataGridControl.View> <Views:TableView ColumnStretchMode="All" ShowRowSelectorPane="True" ColumnStretchMinWidth="100"> <Views:TableView.FixedHeaders> <DataTemplate> <XceedDG:InsertionRow Height="40"/> </DataTemplate> </Views:TableView.FixedHeaders> </Views:TableView> </XceedDG:DataGridControl.View> <!--Group Header formatting--> <XceedDG:DataGridControl.Resources> <Style TargetType="{x:Type XceedDG:GroupByControl}"> <Setter Property="Visibility" Value="Collapsed"/> </Style> <Style TargetType="{x:Type XceedDG:DataCell}"> <Setter Property="Background" Value="Red"/> </Style> </XceedDG:DataGridControl.Resources> ...

    Read the article

  • NSTableView is not showing my data. Why is that happening?

    - by lampShade
    I'm making a "simple" to-do-list project and running into a few bumps in the road. The problem is that my NSTableView is NOT showing the data from the NSMutableArray "myArray" and I don't know why that is. Can someone point out my mistake? /* IBOutlet NSTextField *textField; IBOutlet NSTabView *tableView; IBOutlet NSButton *button; NSMutableArray *myArray; */ #import "AppController.h" @implementation AppController -(IBAction)addNewItem:(id)sender { NSString *myString = [textField stringValue]; NSLog(@"my stirng is %@",myString); myArray = [[NSMutableArray alloc] initWithCapacity:100]; [myArray addObject:myString]; } - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return [myArray count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return [myArray objectAtIndex:rowIndex]; } -(id)init { [super init]; [tableView setDataSource:self]; [tableView setDelegate:self]; NSLog(@"init"); return self; } @end

    Read the article

  • Unrecognised selector sent to instance uitableview

    - by ct2k7
    I'm getting error: Unrecognised selector sent to instance, upon inspection, I see there is an issue in this section of code, and more specifically: [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { if(searching) return; //Add the overlay view. ovController = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:[NSBundle mainBundle]]; CGFloat yaxis = self.navigationController.navigationBar.frame.size.height; CGFloat width = self.view.frame.size.width; CGFloat height = self.view.frame.size.height; //Parameters x = origion on x-axis, y = origon on y-axis. CGRect frame = CGRectMake(0, yaxis, width, height); ovController.view.frame = frame; ovController.view.backgroundColor = [UIColor grayColor]; ovController.view.alpha = 0.5; ovController.rvController = self; [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; searching = YES; letUserSelectRow = NO; //self.tableView.scrollEnabled = NO; } Looks like there's an issue with tableview?

    Read the article

  • iPhone: contentInset isn't animating

    - by Cuzog
    In my app, I have a table view. When the user clicks a button, a UIView overlays part of that table view. It's essentially a partial modal. That table view is intentionally still scrollable while that modal is active. To allow the user to scroll to the bottom of the table view, I change the contentInset and scrollIndicatorInsets values to adjust for the smaller area above the modal. When the modal is taken away, I reset those inset values. The problem is that when the user has scrolled to the bottom of the newly adjusted inset and then dismisses the modal, the table view jumps abruptly to a new scroll position because the inset is changed instantly. I would like to animate it so there is a transition, but the beginAnimation/commitAnimations methods aren't affecting it for some reason. Any ideas as to why the values aren't getting animated? Any help is greatly appreciated! The relevant code from the table view controller is here: - (void)viewDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modalOpened) name:@"ModalStartedOpening" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modalDismissed) name:@"ModalStartedClosing" object:nil]; [super viewDidLoad]; } - (void)modalOpened { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 201, 0); self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 201, 0); [UIView commitAnimations]; } - (void)modalDismissed { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 0, 0); [UIView commitAnimations]; }

    Read the article

  • iPhone: Cell imageViews repeating when loaded from url

    - by araid
    I'm developing a demo RSS reader for iPhone. I obviously have a tableview to display the feeds, and then a detailed view. Some of this feeds have a thumbnail that I want to display on cell.imageview of the table, and some don't. The problem is that when scrolling the table, loaded thumbnails start repeating on other cells, and I end up with a thumbnail on every cell. Here's a piece of my code. I may upload screenshots later - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: @"rssItemCell"]; if(nil == cell){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"rssItemCell"]autorelease]; } BlogRss *item = [[[self rssParser]rssItems]objectAtIndex:indexPath.row]; cell.textLabel.text = [item title]; cell.detailTextLabel.text = [item description]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // Thumbnail if exists if(noticia.imagePath != nil){ NSData* imageData; @try { imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:item.imagePath]]; } @catch (NSException * e) { //Some error while downloading data } @finally { item.image = [[UIImage alloc] initWithData:imageData]; [imageData release]; } } if(item.image != nil){ [[cell imageView] setImage:item.image]; } return cell; } Any help will be very appreciated.

    Read the article

  • iPhone: UITableView not Displaying New Data After Call to reloadData

    - by donnib
    My problem is that the cell.textLabel does not display the new data following a reload. I can see the cellForRowAtIndexPath being called so I know the reloadData call goes thru. If I log the rowString I see the correct value so the string I set label text to is correct. What am I doing wrong? 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]; }

    Read the article

  • How can I programmatically add more than just one view object to my view controller?

    - by BeachRunnerJoe
    I'm diving into iPhone OS development and I'm trying to understand how I can add multiple view objects to the "Left/Root" view of my SplitView iPad app. I've figured out how to programmatically add a TableView to that view based on the example code I found in Apple's online documentation... RootViewController.h @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate, UITableViewDelegate, UITableViewDataSource> { DetailViewController *detailViewController; UITableView *tableView; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } RootViewController.m - (void)loadView { UITableView *newTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; newTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; newTableView.delegate = self; newTableView.dataSource = self; [newTableView reloadData]; self.view = newTableView; [newTableView release]; } but there are a few things I don't understand about it and I was hoping you veterans could help clear up some confusion. In the statement self.view = newTableView, I assume I'm setting the entire view to a single UITableView. If that's the case, then how can I add additional view objects to that view alongside the table view? For example, if I wanted to have a DatePicker view object and the TableView object instead of just the TableView object, then how would I programmatically add that? Referencing the code above, how can I resize the table view to make room for the DatePicker view object that I'd like to add? Thanks so much in advance for your help! I'm going to continue researching these questions right now.

    Read the article

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