Search Results

Search found 295 results on 12 pages for 'uitableviewcontroller'.

Page 11/12 | < Previous Page | 7 8 9 10 11 12  | Next Page >

  • [iOS] becomeFirstResponder: automatically scroll to the UIControl that becomes first responder

    - by Manni
    I have a grouped UITableViewController with one section and many rows. Each cell consists of two elements: a UILabel with a description and a UITextField for an input. A form, I would say. On the bottom is a button "Next" the go to the next view. But before that, I validate the UITextField's: if the user hasn't filled a field, this field should get the focus, so that the user sees that he needs to enter something. I tried with this: [inputField becomeFirstResponder]; Remember, the button I pressed is on the bottom of my view and imagine that the UITextField is on the top. In this situation, the field doesn't get the focus because it is too far away. Now when I scroll up slowly and the field gets visible, the field becomes first responder and gets the cursor :-) Conclusion: The becomeFirstResponder worked, but does not exactly do what I wanted to. I don't want to scroll up with my finger, the field should get the focus and visible automatically. Is there any way to "jump" directly to my field? Use an alternative to becomeFirstResponder? Scroll to my field automatically? Thanks for your help!

    Read the article

  • UIWebview does not show up into UINavigationController

    - by Pato
    Hi I have a tabBar application. In the first tab, I have a navigation bar. In this navigation bar I have a table view. When the user clicks a cell of the table, it goes to another table view, and when the user clicks a cell in that table, it goes to a webview to open a web page. Basically, it goes fine until opening the webview. In the webview, viewDidLoad is called and seems to work properly. However, webViewDidStartLoad is never called and the web page never shows up. I am not using IB. I build the UITabBarController in the AppDelegate, where I also assign an instance of my UINavigationController for each tab. I call the webview from the second UITableViewController as follows: rssWebViewController = [[webViews objectAtIndex: indexPath.row] objectForKey:@"controller"]; [[self navigationController] pushViewController:rssWebViewController animated:YES]; I have checked that the navigationController is there and it seems just fine. The viewDidload of my webview is as follows: - (void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = self.storyUrl; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [[self rssWebView] setDelegate: self]; [[self view] addSubview:[self rssWebView]]; [rssWebView loadRequest:requestObj]; self.rssWebView.scalesPageToFit = YES; self.rssWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); } The web view controller interface is defined as follows: @interface RSSWebViewController : UIViewController <UIWebViewDelegate>{ IBOutlet UIWebView *rssWebView; IBOutlet NSString *storyUrl; IBOutlet NSString *feedName; } @property (nonatomic, retain) IBOutlet UIWebView *rssWebView; @property (nonatomic, retain) IBOutlet NSString *storyUrl; @property (nonatomic, retain) IBOutlet NSString *feedName; @end Any help is greatly appreciated.

    Read the article

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

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

    Read the article

  • UIImagePickerController random behavior

    - by pion
    I have the following code snippets: @interface PinRecordNewTableViewController : UITableViewController { } ... @implementation PinRecordNewTableViewController ... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... PinRecordNewPicture *pinRecordNewPicture = [[PinRecordNewPicture alloc] initWithNibName:@"PinRecordNewPicture" bundle:nil]; pinRecordNewPicture.delegate = self; [self.navigationController pushViewController:pinRecordNewPicture animated:YES]; [pinRecordNewPicture release]; ... } @interface PinRecordNewPicture : UIViewController ... @implementation PinRecordNewPicture ... - (void)picturePicker:(UIImagePickerControllerSourceType)theSource { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = theSource; picker.allowsEditing = YES; [self presentModalViewController:picker animated:YES]; [picker release]; } - (IBAction) takePicture:(id)sender { UIImagePickerControllerSourceType source = UIImagePickerControllerSourceTypeCamera; if ([UIImagePickerController isSourceTypeAvailable:source]) { [self picturePicker:source]; } It works 80% of the time -- I could get the picture correctly. The problem is that it occasionally failed to take a picture. When tracing the code, I found out that it occasionally goes to -PinRecordNewTableViewController:viewDidUnload. This is where it fails because it set nil to all ivars. What did I do wrong? Did I miss something so it behaves "randomly"? Thanks in advance for your help.

    Read the article

  • Why is my UITableView not being set?

    - by Jamie L
    I checked using the debbuger in the viewDidLoad method and tracerTableView is 0x0 which i assume means it is nil. I don't understand. I should go ahaed say yes I have already checked my nib file and yes all the connections are correct. Here is the header file and the begging of the .m. ///////////// .h file //////////// @interface TrackerListController : UITableViewController { // The mutable (modifiable) dictionary days holds all the data for the days tab NSMutableArray *trackerList; UITableView *tracerTableView; } @property (nonatomic, retain) NSMutableArray *trackerList; @property (nonatomic, retain) IBOutlet UITableView. *tracerTableView; //The addPackage: method is invoked when the user taps the addbutton created at runtime. -(void) addPackage : (id) sender; @end /////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////// .m file ////////////////////////////////////// @implementation TrackerListController @synthesize trackerList, tracerTableView; (void)viewDidLoad { [super viewDidLoad]; self.title = @"Package Tracker"; self.navigationItem.leftBarButtonItem = self.editButtonItem; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPackage:)]; // Set up the Add custom button on the right of the navigation bar self.navigationItem.rightBarButtonItem = addButton; [addButton release]; // Release the addButton from memory since it is no longer needed }

    Read the article

  • Can get members, but not count of NSMutableArray

    - by Curyous
    I'm filling an NSMutableArray from a CoreData call. I can get the first object, but when I try to get the count, the app crashes with Program received signal: “EXC_BAD_ACCESS”. How can I get the count? Here's the relevant code - I've put a comment on the line where it crashes. - (void)viewDidLoad { [super viewDidLoad]; managedObjectContext = [[MySingleton sharedInstance] managedObjectContext]; if (managedObjectContext != nil) { charactersRequest = [[NSFetchRequest alloc] init]; charactersEntity = [NSEntityDescription entityForName:@"Character" inManagedObjectContext:managedObjectContext]; [charactersEntity retain]; [charactersRequest setEntity:charactersEntity]; [charactersRequest retain]; NSError *error; characters = [[managedObjectContext executeFetchRequest:charactersRequest error:&error] mutableCopy]; if (characters == nil) { NSLog(@"Did not get results for characters: %@", error.localizedDescription); } else { [characters retain]; NSLog(@"Found some character(s)."); Character* character = (Character *)[characters objectAtIndex:0]; NSLog(@"Name of first one: %@", character.name); NSLog(@"Found %@ character(s).", characters.count); // Crashes on this line with - Program received signal: “EXC_BAD_ACCESS”. } } } And previous declarations from the header file: @interface CrowdViewController : UITableViewController { NSManagedObjectContext *managedObjectContext; NSFetchRequest *charactersRequest; NSEntityDescription *charactersEntity; NSMutableArray *characters; } I'm a bit perplexed and would really appreciate finding out what is going on.

    Read the article

  • How can I remove the present view when I have added more than one subView ?

    - by srikanth rongali
    How can I remove the present view when I touched the close button. I did [self.view removeFromSuperView] when I added only one subView. It worked. But, I have now added another subView to the previous subView. I need to to get the parent view . How can I do it. My code of adding the subView is here. When I did the following only one view is removed. //FirstViewController: UIViewController -(void)libraryFunction:(id)sender { LibraryController *libraryController = [[LibraryController alloc]init]; [self.view addSubview:libraryController.view]; } //LibraryController: UIViewController -(void)viewDidLoad{ RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; self.navController = aNavigationController; [aNavigationController release]; [rootViewController release]; [self.view addSubview:navController.view]; } //RootViewController: UITableViewController - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)]; } -(void)close:(id)sender { [self.view removeFromSuperview]; } Thank You.

    Read the article

  • How to get address the object of an related entity with CoreData ?

    - by eemceebee
    Hi Ok, after I ran into a dead end modifieing an existing Apple example for CoreData, I started completely new creating my own project and that worked fine,..... until I tried to access a related entity. So here is what I did. I created 2 entities, where one is just the detail information of the other one, so there is a one-2-one relationship. Entity #1, Stocks: name value details -- relationship to Entity #2 Entity #2, StockDetails: bank published stock -- relationship to Entity #1 Now, I created the "Managed Object Class" for both of the Entities. Then I created a few lines to put some data into it NSManagedObjectContext *context = [self managedObjectContext]; Stocks *stockinfo= [NSEntityDescription insertNewObjectForEntityForName:@"Stocks" inManagedObjectContext:context]; stockinfo.name = @"Apple"; stockinfo.value = [NSNumber numberWithInt:200]; StockDetails *thestockdetails = [NSEntityDescription insertNewObjectForEntityForName:@"StockDetails" inManagedObjectContext:context]; thestockdetails.bank = @"Bank of America"; thestockdetails.published = [NSDate date]; thestockdetails.stock = stocks_; stockinfo.details = thestockdetails ; NSError *error; if (![context save:&error]) { NSLog(@"A Problem occured, couldn't save: %@", [error localizedDescription]); } Just want to mention here, that I do not get an error with this. Next I put everything into a UITableViewController for a preview and another for a detail view. The preview just shows infos form Entity #1 (Stocks) and when selected it shows the detail view. Now here I also display the infos form Entity #1 (Stocks) but I want to show the Entity #2 (StockDetails) aswell. This is how I try to access the data : StockDetails *details_ = [stockinfo details]; And this gives me a EXC_BAD_ACCESS. So any idea what I am doing wrong here ? Thanks

    Read the article

  • Unable to dismiss MFMailComposeViewController, delegate not called

    - by Rod
    HI, I am calling MFMailComposeViewController from UITableViewController. Problem is, delegate method mailComposeController:(MFMailComposeViewController)controllerdidFinishWithResult* is never called when I select Cancel or Send button in Mail compose window. Here is the table view class: @implementation DetailsTableViewController - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section==0 && indexPath.row==4){ //SEND MAIL MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; if ([MFMailComposeViewController canSendMail]) { [controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]]; [controller setMessageBody:@" " isHTML:NO]; [controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]]; [self presentModalViewController:controller animated:YES]; } [controller release]; } } - (void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { // NEVER REACHES THIS PLACE [self dismissModalViewControllerAnimated:YES]; NSLog (@"mail finished"); } The application don't crash. After Cancel or Send button is presses Compose Window stays on the screen with buttons disabled. I can exit application pressing Home key. I am able to open other Modal Views form TableView but not MailCompose.

    Read the article

  • Objective-C Definedness

    - by Dan Ray
    This is an agonizingly rookie question, but here I am learning a new language and framework, and I'm trying to answer the question "What is Truth?" as pertains to Obj-C. I'm trying to lazy-load images across the network. I have a data class called Event that has properties including: @property (nonatomic, retain) UIImage image; @property (nonatomic, retain) UIImage thumbnail; in my AppDelegate, I fetch up a bunch of data about my events (this is an app that shows local arts event listings), and pre-sets each event.image to my default "no-image.png". Then in the UITableViewController where I view these things, I do: if (thisEvent.image == NULL) { NSLog(@"Going for this item's image"); UIImage *tempImage = [UIImage imageWithData:[NSData dataWithContentsOfURL: [NSURL URLWithString: [NSString stringWithFormat: @"http://www.mysite.com/content_elements/%@_image_1.jpg", thisEvent.guid]]]]; thisEvent.image = tempImage; } We never get that NSLog call. Testing thisEvent.image for NULLness isn't the thing. I've tried == nil as well, but that also doesn't work.

    Read the article

  • UINavigationController from scratch?

    - by Moshe
    I have a view based app that works well. (In other words, I'm not going to start over with a Navigation-Based App template.) It's an immersive app of sorts and I'm trying to add a Table View that loads in a new view when a button is pressed. The loading the nib part works, but I can't seem to be able to add a navigation controller to the new view. I want to see a navigation bar on top with a done button and an edit button. Also, I want to the Table View entries to be empty. I added a new file like so: File-> New File -> UINavigationController subclass. I checked the UITableViewController Subclass and With XIB for user interface. All I see when the view is pulled up is a blank Table View. I am able to customize things in the view controller. What can I do to make the table show a navigation bar and be editable? I need some direction here please. EDIT: I'm working with the latest Public SDK. (XCode 3.2.2)

    Read the article

  • I have a serious problem to use 'happle' in xcode project.

    - by Daniel K
    Hello. I am a korean student, and I'm trying to develop a iphone application. I want to make the application which will shows contents of Web board, which is belong to some website. I will use 'UITableViewController", and the names of contents have to be displayed on table view. I heard that if I want to scrap the text on webpage, I have to use 'parser'. However, Iphone SDKs provide only the parser for xml webpage, NSXmlParser. In my acknowledges, NSXmlParser is not for HTML webpage, so it doesn't provide HTML parsing. If there is any way to parse HTML page with NSXmlParser, I want to know how to use that. Anyway, I found a simple and good HTML parser, 'happle', through searching on google. I tried to add the sources of happle on my xcode project, and I also add the libxml2.2.dylib, and I even set up 'Header search paths' and 'Other Linker Flags'. However It doesn't work. The Compiler show a error message : "No such file in dictionary". In my opinion, there is no frameworks file in my computer, so I tried to set up 'libxml2 frameworks' many times, but I coundn't success. please help me how to parse HTML page and how to set up libxml2... It really urgent. p.s. please forgive my ugly English

    Read the article

  • Undeclared - 'first use in function'

    - by Ragunath Jawahar
    I'm new to Objective-C, though I have a very good hand in Android. I'm trying to make a call to a method but it gives me 'first use in function'. I know I'm making a silly mistake but experts could figure it out easily. RootViewController.h #import <UIKit/UIKit.h> #import "ContentViewController.h" @interface RootViewController : UITableViewController { ContentViewController *contentViewController; } @property (nonatomic, retain) ContentViewController *contentViewController; - (NSString*)getContentFileName:(NSString*)title; //<--- This function declartion @end RootViewController.m #import "RootViewController.h" #import "HAWATAppDelegate.h" #import "ContentViewController.h" @implementation RootViewController @synthesize contentViewController; ... more methods ... #pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { HAWATAppDelegate *appDelegate = (HAWATAppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *title = (NSString *) [appDelegate.titles objectAtIndex:indexPath.row]; NSString *fileName = getContentFileName:title; //<--- Here is the error ... } - (NSString*) getContentFileName:(NSString*)title { return [title lowercaseString]; } @end There must be a simple thing I'm missing. Please let me know. Thanks in advance.

    Read the article

  • Get notified when UITableView has finished asking for data?

    - by kennethmac2000
    Hi everyone, Is there some way to find out when a UITableView has finished asking for data from its data source? None of the viewDidLoad/viewWillAppear/viewDidAppear methods of the associated view controller (UITableViewController) are of use here, as they all fire too early. None of them (entirely understandably) guarantee that queries to the data source have finished for the time being (eg, until the view is scrolled). One workaround I have found is to call reloadData in viewDidAppear, since, when reloadData returns, the table view is guaranteed to have finished querying the data source as much as it needs to for the time being. However, this seems rather nasty, as I assume it is causing the data source to be asked for the same information twice (once automatically, and once because of the reloadData call) when it is first loaded. The reason I want to do this at all is that I want to preserve the scroll position of the UITableView - but right down to the pixel level, not just to the nearest row. When restoring the scroll position (using scrollRectToVisible:animated:), I need the table view to already have sufficient data in it, or else the scrollRectToVisible:animated: method call does nothing (which is what happens if you place the call on its own in any of viewDidLoad, viewWillAppear or viewDidAppear). Thanks in advance for your assistance!

    Read the article

  • Can't use method from class in other file

    - by user1833848
    I am not able to use one of my methods that i implemented in my tableviewcell file in my tableview controller implementation. I tried searching the web and xcode help with no luck. My codes looks like this: TableViewController.h: #import TableViewCell.h @interface TableViewController : UITableViewController @property (nonatomic, strong) IBOutlet UIBarButtonItem *A1Buy; @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender; TableViewController.m: @implementation A1ViewController @synthesize A1Buy = _A1Buy; @synthesize userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender { [TableViewCell Enable]; //this is where it gives an error } TableViewCell.h: @interface TableViewCell : UITableViewCell { BOOL Enable; BOOL Disable; } @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; TableViewCell.m: @implementation TableViewCell; @synthesize userInteractionEnabled; - (BOOL) Enable { return userInteractionEnabled = YES; } - (BOOL) Disable { return userInteractionEnabled = NO; } As you can see i am trying to enable user interaction with a button, but Xcode only gives me errors like "class does not have this method" and stuff like that. All files are importet correctly so thats not why. Would appreciate any help. Thanks!

    Read the article

  • How do I display core data on second view controller?

    - by jon
    I am working on my first core data iPhone application. I am using a navigation controller, and the root view controller displays 4 rows. Clicking the first row takes me to a second table view controller. However, when I click the back button, repeat the row tap, click the back button again, and tap the row a third time, I get an error. I have been researching this for a week with no success. I can reproduce the error easily: Create a new Navigation-based Application, use Core Data for storage, call it MyTest which creates MyTestAppDelegate and RootViewController. Add new UIViewController subclass, with UITableViewController and xib, call it ListViewController. Copy code from RootViewController.h and .m to ListViewController.h and .m., changing the file names appropriately. To simplify the code, I removed the trailing “_” from all variables. In RootViewController, I added #import ListViewController.h, set up an array to display 4 rows and navigate to ListViewController when clicking the first row. In ListViewController.m, I added #import MyTestAppDelegate.h” and the following code: - (void)viewDidLoad { [super viewDidLoad]; if (managedObjectContext == nil) { managedObjectContext = [(MyTestAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; } .. } The sequence that causes the error is tap row, return, tap row, return, tap row - error. managedObjectContext is synthesized for the third time. I appreciate your patience and your help, as this makes no sense to me. ADDENDUM: I may have a partial solution. http://www.iphonedevsdk.com/forum/iphone-sdk-development/41688-accessing-app-delegates-managed-object-context.html If I do not release the managedObjectContext in the .m file, the error goes away. Is that ok or will that cause me issues? - (void)dealloc { [fetchedResultsController release]; // [managedObjectContext release]; [super dealloc]; } ADDENDUM 2: See solution below. Sorry for the formatting issues - this was my first post.

    Read the article

  • Problem with class methods in objective c

    - by Rajashekar
    Hi Guys i have a tableview controller like so, NSString *selectedindex; @interface ContactsController : UITableViewController { NSMutableArray *names; NSMutableArray *phonenumbers; NSMutableArray *contacts; DatabaseCRUD *sampledatabase; } +(NSString *) returnselectedindex; @end in the implementation file i have +(NSString *) returnselectedindex { return selectedindex; } when a row is selected in the tableview i put have the following code. selectedindex = [NSString stringWithFormat:@"%d", indexPath.row]; NSLog(@"selected row is %@",selectedindex); in a different class i am trying to access the selectedindex. like so selected = [ContactsController returnselectedindex]; NSLog(@"selected is %@",selected); it gives me a warning: 'ContactsController' may not respond to '+returnselectedindex' and crashes. i am not sure why. i have used class methods previously lot of times , and never had a problem. any help please. Thank You.

    Read the article

  • Where would I implement this array to pass?

    - by Keeano Martin
    I currently build an NSMutableArray in Class A.m within the ViewDidLoad Method. - (void)viewDidLoad { [super viewDidLoad]; //Question Array Setup and Alloc stratToolsDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:countButton,@"count",camerButton,@"camera",videoButton,@"video",textButton,@"text",probeButton,@"probe", nil]; stratTools = [[NSMutableArray alloc] initWithObjects:@"Tools",stratToolsDict, nil]; stratObjectsDict = [[NSMutableDictionary alloc]initWithObjectsAndKeys:stratTools,@"Strat1",stratTools,@"Strat2",stratTools,@"Strat3",stratTools,@"Strat4", nil]; stratObjects = [[NSMutableArray alloc]initWithObjects:@"Strategies:",stratObjectsDict,nil]; QuestionDict = [[NSMutableDictionary alloc]initWithObjectsAndKeys:stratObjects,@"Question 1?",stratObjects,@"Question 2?",stratObjects,@"Question 3?",stratObjects,@"Question 4?",stratObjects,@"Question 5?", nil]; //add strategys to questions QuestionsList = [[NSMutableArray alloc]init]; for (int i = 0; i < 1; i++) { [QuestionsList addObject:QuestionDict]; } NSLog(@"Object: %@",QuestionsList); At the end of this method you will see QuestionsList being initialized and now I need to send this Array to Class B. So I place its setters and getters using the @property and @Synthesize method. Class A.h @property (retain, nonatomic) NSMutableDictionary *stratToolsDict; @property (retain, nonatomic) NSMutableArray *stratTools; @property (retain, nonatomic) NSMutableArray *stratObjects; @property (retain, nonatomic) NSMutableDictionary *QuestionDict; @property (retain, nonatomic) NSMutableArray *QuestionsList; Class A.m @synthesize QuestionDict; @synthesize stratToolsDict; @synthesize stratObjects; @synthesize stratTools; @synthesize QuestionsList; I use the property method because I am going to call this variable from Class B and want to be able to assign it to another NSMutableArray. I then add the @property and @class for Class A to Class B.h as well as declare the NSMutableArray in the @interface. #import "Class A.h" @class Class A; @interface Class B : UITableViewController<UITableViewDataSource, UITableViewDelegate>{ NSMutableArray *QuestionList; Class A *arrayQuestions; } @property Class A *arrayQuestions; Then I call NSMutableArray from Class A in the Class B.m -(id)initWithStyle:(UITableViewStyle)style { if ([super initWithStyle:style] != nil) { //Make array arrayQuestions = [[Class A alloc]init]; QuestionList = arrayQuestions.QuestionsList; Right after this I Log the NSMutableArray to view values and check that they are there and it returns NIL. //Log test NSLog(@"QuestionList init method: %@",QuestionList); Info about Class B- Class B is a UIPopOverController for Class A, Class B has one View which holds a UITableView which I have to populate the results of Class A's NSMutableArray. Why is the NsMutableArray coming back as NIL? Ultimately would like some help figuring it out as well, it seems to really have me confused. Help is greatly appreciated!!

    Read the article

  • RestKit : Not able to perform mapping using coredata

    - by Ashish Beuwria
    I'm using rest kit 0.20.3 and Xcode 5. Without core data I'm able to perform all rest kit operation, but when I've tried it with core data, I'm not even able to perform GET due to some problem. I can't figure it out. I'm new with core data. So pls help. Here is my code: AppDelegate.m @implementation CardGameAppDelegate @synthesize managedObjectContext = _managedObjectContext; @synthesize managedObjectModel = _managedObjectModel; @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RKLogConfigureByName("RestKit", RKLogLevelWarning); RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace); RKLogConfigureByName("RestKit/Network", RKLogLevelTrace); RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://192.168.1.3:3010/"]]; RKManagedObjectStore *objectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:self.managedObjectModel]; objectManager.managedObjectStore = objectStore; RKEntityMapping *playerMapping = [RKEntityMapping mappingForEntityForName:@"Player" inManagedObjectStore:objectStore]; [playerMapping addAttributeMappingsFromDictionary:@{@"id": @"playerId", @"name": @"playerName", @"age" : @"playerAge", @"created_at": @"createdAt", @"updated_at": @"updatedAt"}]; RKResponseDescriptor *responseDesc = [RKResponseDescriptor responseDescriptorWithMapping:playerMapping method:RKRequestMethodGET pathPattern:@"/players.json" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]; [objectManager addResponseDescriptor:responseDesc]; PlayersTableViewController *ptvc = (PlayersTableViewController *)self.window.rootViewController; ptvc.managedObjectContext = self.managedObjectContext; return YES; } and code for playerTableViewController.h #import <UIKit/UIKit.h> @interface PlayersTableViewController : UITableViewController <NSFetchedResultsControllerDelegate> @property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; @property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; @end and PlayerTableViewController.m get method: -(void)loadPlayers{ [[RKObjectManager sharedManager] getObjectsAtPath:@"/players.json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){ [self.refreshControl endRefreshing]; } failure:^(RKObjectRequestOperation *operation, NSError *error) { [self.refreshControl endRefreshing]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"An Error Has Occurred" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; }]; } I'm getting the following error : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to perform mapping: No `managedObjectContext` assigned. (Mapping response.URL = http://192.168.1.3:3010/players.json)'

    Read the article

  • indentationLevelForRowAtIndexPath not indenting custom cell

    - by Xetius
    I have overridden the tableView:indentationLevelForRowAtIndexPath method in my UITableViewController derived class as follows: - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary* item = [self.projects objectAtIndex:indexPath.row]; int indentationLevel = [[item objectForKey:@"indent"] intValue]; DLog (@"Indentation Level for Row %d : %d", indexPath.row, indentationLevel); return indentationLevel; } I initially thought that this was not being called but that was operator error (err, mine) and I hadn't defined the symbol DEBUG=1. However, it is being called (duh me!) and this is the log output: -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 0 : 1 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 1 : 1 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 2 : 2 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 3 : 2 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 4 : 2 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 5 : 1 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 6 : 2 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 7 : 2 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 8 : 1 But, this is not affecting the layout of the cells. No indentation. This is my itemCellForRowAtIndexPath implementation, if that makes any difference: -(UITableViewCell*)tableView:(UITableView *)tableView itemCellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellIdentifier = @"projectItemCell"; ProjectItemTableViewCell* cell = (ProjectItemTableViewCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"ProjectItemTableViewCell" owner:self options:nil]; for (id oneObject in nib) { if ([oneObject isKindOfClass:[ProjectItemTableViewCell class]]) { cell = (ProjectItemTableViewCell*)oneObject; } } } NSDictionary* item = [self.projects objectAtIndex:indexPath.row]; cell.projectDescLabel.text = [item objectForKey:@"name"]; cell.itemCountlabel.text = [NSString stringWithFormat:@"%d", [[item objectForKey:@"cache_count"] intValue]]; cell.itemCountlabel.backgroundColor = [UIColor colorForHex:[item objectForKey:@"color"]]; cell.indentationWidth = 20; return cell; } How do I indent a custom UITableViewCell which I have defined in Interface Builder? If I change the itemCellForRowAtIndexPath to use a default UITableViewCell with the code below, then it indents fine. static NSString* cellIdentifier = @"projectItemCell"; UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; } NSDictionary* item = [self.projects objectAtIndex:indexPath.row]; cell.textLabel.text = [item objectForKey:@"name"]; cell.indentationWidth = 40; return cell;

    Read the article

  • Objective-C: properties not being saved or passed

    - by Gerald Yeo
    Hi, i'm a newbie to iphone development. I'm doing a navigation-based app, and I'm having trouble passing values to a new view. @interface RootViewController : UITableViewController { NSString *imgurl; NSMutableArray *galleryArray; } @property (nonatomic, retain) NSString *imgurl; @property (nonatomic, retain) NSMutableArray *galleryArray; - (void)showAll; @end #import "RootViewController.h" #import "ScrollView.h" #import "Model.h" #import "JSON/JSON.h" @implementation RootViewController @synthesize galleryArray, imgurl; - (void)viewDidLoad { UIBarButtonItem *showButton = [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Show All", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(showAll)] autorelease]; self.navigationItem.rightBarButtonItem = showButton; NSString *jsonString = [[Model sharedInstance] jsonFromURLString:@"http://www.ddbstaging.com/gerald/gallery.php"]; NSDictionary *resultDictionary = [jsonString JSONValue]; if (resultDictionary == nil) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Webservice Down" message:@"The webservice you are accessing is currently down. Please try again later." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } else { galleryArray = [[NSMutableArray alloc] init]; galleryArray = [resultDictionary valueForKey:@"gallery"]; imgurl = (NSString *)[galleryArray objectAtIndex:0]; NSLog(@" -> %@", galleryArray); NSLog(imgurl); } } - (void)showAll { NSLog(@" -> %@", galleryArray); NSLog(imgurl); ScrollView *controller = [[ScrollView alloc] initWithJSON:galleryArray]; [self.navigationController pushViewController:controller animated:YES]; } The RootViewController startup and the json data loads up fine. I can see it from the first console trace. However, once I click on the Show All button, the app crashes. It doesn't even trace the galleryArray and imgurl properyly. Maybe additional pairs of eyes can spot my mistakes. Any help is greatly appreciated! [Session started at 2010-05-08 16:16:07 +0800.] 2010-05-08 16:16:07.242 Photos[5892:20b] -> ( ) GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 5892. (gdb)

    Read the article

  • UINavigationBar unresponsive after canceling a UITableView search in nav controller in tab bar in a popover

    - by Mark
    Ok, this is an odd one and I can reproduce it with a new project easily. Here is the setup: I have a UISplitViewController. In the left side I have a UITabBarController. In this tab bar controller I have two UINavigationControllers. In the navigation controllers I have UITableViewControllers. These table views have search bars on them. Ok, what happens with this setup is that if I'm in portrait mode and bring up this view in the popover and I start a search in one of the table views and cancel it, the navigation bar becomes unresponsive. That is, the "back" button as well as the right side button cannot be clicked. If I do the exact same thing in landscape mode so we are not in a popover, this doesn't happen. The navigation bar stays responsive. So, the problem only seems to happen inside a popover. I've also noticed that if I do the search but click on an item in the search results which ends up loading something into the "detail view" of the split view and dismissing the popover, and then come back to the popover and then click the Cancel button for the search, the navigation bar is responsive. My application is a universal app and uses the same tab bar controller in the iPhone interface and it works there without this issue. As I mentioned above, I can easily reproduce this with a new project. Here are the steps if you want to try it out yourself: start new project - split view create new UITableViewController class (i named TableViewController) uncomment out the viewDidLoad method as well as the rightBarButtonItem line in viewDidLoad (so we will have an Edit button in the navigation bar) enter any values you want to return from numberOfSectioinsInTableView and numberOfRowsInSection methods open MainWindow.xib and do the following: please note that you will need to be viewing the xib in the middle "view mode" so you can expand the contents of the items drag a Tab Bar Controller into the xib to replace the Navigation Controller item drag a Navigation Controller into the xib as another item under the Tab Bar Controller delete the other two view controllers that are under the Tab Bar Controller (so, now our tab bar has just the one navigation controller on it) inside the navigation controller, drag in a Table View Controller and use it to replace the View Controller (Root View Controller) change the class of the new Table View Controller to the class created above (TableViewController for me) double-click on the Table View under the new Table View Controller to open it up (will be displayed in the tab bar inside the split view controller) drag a "Search Bar and Search Display" onto the table view save the xib run the project in simulator while in portrait mode, click on the Root List button to bring up popover notice the Edit button is clickable click in the Search box - we go into search mode click the Cancel button to exit search mode notice the Edit button no longer works So, can anyone help me figure out why this is happening? Thanks, Mark

    Read the article

  • How do I add a custom view to iPhone app's UI?

    - by Dr Dork
    I'm diving into iPad development and I'm still learning how everything works together. I understand how to add standard view (i.e. buttons, tableviews, datepicker, etc.) to my UI using both Xcode and Interface Builder, but now I'm trying to add a custom calendar control (TapkuLibrary) to the left window in my UISplitView application. My question is, if I have a custom view (in this case, the TKCalendarMonthView), how do I programmatically add it to one of the views in my UI (in this case, the RootViewController)? Below are some relevant code snippets from my project... RootViewController interface @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> { DetailViewController *detailViewController; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; @property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; - (void)insertNewObject:(id)sender; TKCalendarMonthView interface @class TKMonthGridView,TKCalendarDayView; @protocol TKCalendarMonthViewDelegate, TKCalendarMonthViewDataSource; @interface TKCalendarMonthView : UIView { id <TKCalendarMonthViewDelegate> delegate; id <TKCalendarMonthViewDataSource> dataSource; NSDate *currentMonth; NSDate *selectedMonth; NSMutableArray *deck; UIButton *left; NSString *monthYear; UIButton *right; UIImageView *shadow; UIScrollView *scrollView; } @property (readonly,nonatomic) NSString *monthYear; @property (readonly,nonatomic) NSDate *monthDate; @property (assign,nonatomic) id <TKCalendarMonthViewDataSource> dataSource; @property (assign,nonatomic) id <TKCalendarMonthViewDelegate> delegate; - (id) init; - (void) reload; - (void) selectDate:(NSDate *)date; Thanks in advance for all your help! I still have a ton to learn, so I apologize if the question is absurd in any way. I'm going to continue researching this question right now!

    Read the article

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

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

    Read the article

  • Problem while adding new Object to CoreData App

    - by elementsense
    Hi Another Day, another CoreData problem,...but hopefully the last one now. Ok here is a copy of what I have : I have a List of Hotel Guests that stay in one Room and have Preferences. Once ready the user should select a guest and see the data and should also be able to add new guest, select the room (maintained also by application) and select their preferences (where the user can also add new preferences). The guest can have no or many preferences. So here is what I have so far. I created 3 Entities : - Rooms with roomnumber - Preferences with name - GuestInfo with name - with these Relationships room (Destination Rooms) and prefs (Destination Preferences with "To-Many Relationship") The prefs is a NSSet when you create a Managed Object Class. Now I created a UITableViewController to display all the data. I also have an edit and add mode. When I add a new Guest and just fill out the name, everything works fine. But when I want to add the prefs or the room number I get this error : Illegal attempt to establish a relationship 'room' between objects in different contexts Now, what confuses me is that when I add a guest and enter just the name, save it, go back and edit it and select the prefs and room number it works ? I have this line in both ViewControllers to select the room or prefs : [editedObject setValue:selectedRoom forKey:editedFieldKey]; with this .h : NSManagedObject *editedObject; NSString *editedFieldKey; NSString *editedFieldName; Again, it works on the editing mode but not when I want to add a fresh object. And to be sure, this is what I do for adding an new Guest : - (IBAction)addNewItem { AddViewController *addViewController = [[AddViewController alloc] initWithStyle:UITableViewStyleGrouped]; addViewController.delegate = self; addViewController.context = _context; // Create a new managed object context for the new book -- set its persistent store coordinator to the same as that from the fetched results controller's context. NSManagedObjectContext *addingContext = [[NSManagedObjectContext alloc] init]; self.addingManagedObjectContext = addingContext; [addingContext release]; [addingManagedObjectContext setPersistentStoreCoordinator:[[_fetchedResultsController managedObjectContext] persistentStoreCoordinator]]; GuestInfo *info = (GuestInfo *)[NSEntityDescription insertNewObjectForEntityForName:@"GuestInfo" inManagedObjectContext:addingContext]; addViewController.info = info; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addViewController]; [self.navigationController presentModalViewController:navController animated:YES]; [addViewController release]; [navController release]; } Anything I have to do to initialize the Room or Prefs ? Hope someone can help me out. Thanks

    Read the article

< Previous Page | 7 8 9 10 11 12  | Next Page >