Search Results

Search found 439 results on 18 pages for 'navigationcontroller'.

Page 3/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • iPhone application lifecycle

    - by iter
    InterfaceBuilder generates this method for me in fooAppDelegate.m: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } IB also puts UIWindow *window; in fooAppDelegate.h and @synthesize window; in fooAppDelegate.m, and correspondingly for navigationController. IB generates code to release window and navigationController in dealloc. I cannot see any code that allocates and initializes the window and the navigationController. I wonder where that happens. Ari.

    Read the article

  • How to add a leftBarButtonItem to ABPeoplePickerNavigationController?

    - by al_lea
    Tried this, but doesn't work: ABPeoplePickerNavigationController * people_picker = [[ABPeoplePickerNavigationController alloc] init]; people_picker.peoplePickerDelegate = self; self.navigationController.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle: @"send" style: self.navigationController.navigationItem.rightBarButtonItem.style target: self action: @selector(cancelAddressBook)] autorelease]; [self.navigationController presentModalViewController: people_picker animated: YES];

    Read the article

  • UInavigationbar

    - by sudhakarilla
    Hello, I have a problem... In my navigationcontroller. i have not working navigationcontroller.How to create navigationcontroller in viewbasedapplication Please help in this issue.

    Read the article

  • Converting a navbar to a tabbar app

    - by Nick
    Hey guys, I was wondering how to convert a NavigationController style app into a TabBarcontroller style app. I changed my mainwindow to not contain a navigationcontroller anymore (but a tabbarcontroller instead) and my delegate also appropiatly, but when I launch the app something still thinks I want a navigationController: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navigationController.' Stack trace: #0 0x020fa004 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ #1 0x96fc0509 in objc_exception_throw #2 0x020ee1c1 in -[NSException raise] #3 0x000d8a78 in _NSSetUsingKeyValueSetter #4 0x000d84c5 in -[NSObject(NSKeyValueCoding) setValue:forKey:] #5 0x004fb4c8 in -[UIRuntimeOutletConnection connect] #6 0x020af92f in -[NSArray makeObjectsPerformSelector:] #7 0x004f9f7f in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] #8 0x004fbfcb in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] #9 0x0033b0a6 in -[UIApplication _loadMainNibFile] #10 0x0034482a in -[UIApplication _runWithURL:sourceBundleID:] #11 0x00341b88 in -[UIApplication handleEvent:withNewEvent:] #12 0x0033d6d3 in -[UIApplication sendEvent:] #13 0x003440b5 in _UIApplicationHandleEvent #14 0x0265aed1 in PurpleEventCallback #15 0x02092b80 in CFRunLoopRunSpecific #16 0x02091c48 in CFRunLoopRunInMode #17 0x0033be69 in -[UIApplication _run] #18 0x00345003 in UIApplicationMain #19 0x00002ec8 in main at main.m:14 Where can I specify the app is a tabbarcontrolled app, instead of a navigationbarcontrolled app? Thanks in advance,

    Read the article

  • iphone selecting a row to change view

    - by Rob J
    I have created the view Controllers and attached those to control their respective views. I can't figure out how to make the following code to go the right views though. (This is in the root view controller:) - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { RunViewController *runViewController = [[RunViewController alloc] initWithNibName:@"RunView" bundle:[NSBundle mainBundle]]; CalcViewController *calcViewController = [[CalcViewController alloc] initWithNibName:@"CalcView" bundle:[NSBundle mainBundle]]; PushViewController *pushViewController = [[PushViewController alloc] initWithNibName:@"PushView" bundle:[NSBundle mainBundle]]; SitViewController *sitViewController = [[SitViewController alloc] initWithNibName:@"SitView" bundle:[NSBundle mainBundle]]; TimerViewController *timerViewController = [[TimerViewController alloc] initWithNibName:@"TimerView" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:runViewController animated:YES]; [runViewController release]; [self.navigationController pushViewController:pushViewController animated:YES]; [pushViewController release]; [self.navigationController pushViewController:sitViewController animated:YES]; [sitViewController release]; [self.navigationController pushViewController:timerViewController animated:YES]; [timerViewController release]; [self.navigationController pushViewController:calcViewController animated:YES]; [calcViewController release]; runViewController = nil; pushViewController = nil; sitViewController = nil; timerViewController = nil; calcViewController = nil; } Each time I select any of the rows in the table - all of the views come up. How do I arrange them to only open the view that it is supposed to?

    Read the article

  • Act on click of a button on the Nav Bar for moreNavigationController -- Can't pushviewcontroller

    - by Jann
    Okay, here is my issue: My app has a display of categories in the tab bar at the bottom of the iPhoneOS screen. This only allows 5 categories before it presents the MORE button. I have over 25 (please do not answer this by saying: "Rethink your application...etc" -- that was rudely said before. They are food, drink, etc categories and cannot be changed). I want to allow the user to put their favorites on the home page. The Apple moreNavigationController editing system only allows 20 tab bar items to be rearranged due to space constraints on the editing page. This is not enough so i need to implement my own Editing screen. I set the rightBarButtonItem to nil and created my own. Using NSLog, i can see the "click" happens when clicking the EDIT button, but I cannot push using pushViewController. Nothing happens. I think it has something to do with the navigationController I am addressing...but i am not sure. ps: This all happens in my App Delegate which DOES act as both UITabBarControllerDelegate & UINavigationControllerDelegate. I tried to do the following: - ( void )navigationController:( UINavigationController * )navigationController_local willShowViewController:( UIViewController * )viewController_local animated:( BOOL )animated { UIViewController * currentController = navigationController_local.visibleViewController; UIViewController * nextController = viewController_local; // Do whatever here. NSLog(@"Nav contoller willShowViewController fired\n'%@'\n'%@'\nThere are currently: %d views on the stack\n",currentController,nextController,[self.navigationController.viewControllers count]); if ( [nextController isKindOfClass:NSClassFromString(@"UIMoreListController")]) { UINavigationBar *morenavbar = navigationController_local.navigationBar; UINavigationItem *morenavitem = morenavbar.topItem; morenavitem.rightBarButtonItem = nil; NSLog(@"Is a UIMoreListController\n"); UIBarButtonItem *editTabBarButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStylePlain target:self action:@selector(editTabBar:)]; morenavitem.rightBarButtonItem = editTabBarButton; [editTabBarButton release]; } } This works to place an EDIT button at the top right of the screen -- mimicking Apple's look and feel... but when that button is clicked, you cannot exit the darn moreNavigationController. I have tried many things. UIAlerts work, etc...but pushing (or popping -- even popping to root view) a view controller on the stack does not. - (void) editTabBar:(id)sender { NSLog(@"clicked edit tabbar\n"); NSLog(@"Total count of controllers: %d\n",[self.navigationController.viewControllers count]); TabBarViewController *tabBarViewController2 = [[TabBarViewController alloc] initWithNibName:@"TabBarView" bundle:nil]; tabBarViewController2.navigationItem.title=@"Edit Tab Bar"; [self.navigationController pushViewController:tabBarViewController2 animated:YES]; [tabBarViewController2 release]; NSLog(@"finished edit tabbar\n"); } If you click the edit button on the moreNavigationController's display page, you get the log entries like expected AND (this is strange) the views on the stack climbs -- but no page change occurs. I marked it down to not using the correct navigation controller...but I am lost on how to find which one TO use. this is a weird one too. In the edit function if i just do this: - (void) editTabBar:(id)sender { self.tabBarController.selectedIndex = 0; } It DOES take me home (to tabbarcontroller 0) BUT doing this: - (void) editTabBar:(id)sender { [self.navigationController popToRootViewControllerAnimated:YES]; } does not work. Does the moreNavigationController have some special quality that screws with the rest of the system?

    Read the article

  • Push notification not received in ios5 device

    - by Surender Rathore
    I am sending push notification on device which has iOS 5.0.1, but notification is not received on iOS5 device. If i try to send notification on iOS4.3.3 device, it received on this device. My server is developed in c# and apple push notification certificate is used in .p12 format. My code to register the notification is - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // Set the navigation controller as the window's root view controller and display. deviceToken = nil; self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert]; return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken { UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"Succeeded in registering for APNS" message:@"Sucess" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alertView show]; [alertView release]; deviceToken = [devToken retain]; NSMutableString *dev = [[NSMutableString alloc] init]; NSRange r; r.length = 1; unsigned char c; for (int i = 0; i < [deviceToken length]; i++) { r.location = i; [deviceToken getBytes:&c range:r]; if (c < 10) { [dev appendFormat:@"0%x", c]; } else { [dev appendFormat:@"%x", c]; } } NSUserDefaults *def = [NSUserDefaults standardUserDefaults]; [def setObject:dev forKey:@"DeviceToken"]; [def synchronize]; NSLog(@"Registered for APNS %@\n%@", deviceToken, dev); [dev release]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"Failed to register %@", [error localizedDescription]); UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"FAILED" message:@"Fail" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alertView show]; [alertView release]; deviceToken = nil; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { NSLog(@"Recieved Remote Notification %@", userInfo); NSDictionary *aps = [userInfo objectForKey:@"aps"]; NSDictionary *alert = [aps objectForKey:@"alert"]; //NSString *actionLocKey = [alert objectForKey:@"action-loc-key"]; NSString *body = [alert objectForKey:@"body"]; // NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:[self.navigationController viewControllers]]; // // if ([viewControllers count] > 2) { // NSRange r; // r.length = [viewControllers count] - 2; // r.location = 2; // [viewControllers removeObjectsInRange:r]; // // MapViewController *map = (MapViewController*)[viewControllers objectAtIndex:1]; // [map askDriver]; // } // // [self.navigationController setViewControllers:viewControllers]; // [viewControllers release]; //NewBooking,"BookingId",Passenger_latitude,Passenger_longitude,Destination_latitude,Destination_longitude,Distance,Time,comments NSArray *arr = [body componentsSeparatedByString:@","]; if ([arr count]>0) { MapViewController *map = (MapViewController*)[[self.navigationController viewControllers] objectAtIndex:1]; [map askDriver:arr]; [self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:1] animated:YES]; } //NSString *sound = [userInfo objectForKey:@"sound"]; //UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:actionLocKey // message:body delegate:nil // cancelButtonTitle:@"Reject" // otherButtonTitles:@"Accept", nil]; // // [alertV show]; // [alertV release]; } Can anyone help me out with this issue. Why notification received on iOS4.3 device but not on iOS5? Thank you very much!!! in advance

    Read the article

  • how to pass a string value from one controller to another

    - by shreedevi
    I have a login controller ,and after the successful login i want to pass some string value to the menu page.however it does not work.the application crashes. I have tried possible suggesstion of Ihuk and SAM from the link below http://stackoverflow.com/questions/1685964/how-to-pass-a-string-value-from-one-view-controller-to-another-view-controller loginController.h: #import <UIKit/UIKit.h> @class RootViewController; @class Menu; @interface LoginController : UIViewController { UIButton *login_Button; UITextField *username_TextField; UITextField *password_TextField; RootViewController *mc1; UINavigationController *navigationController; Menu *mv1; } @property(nonatomic,retain) IBOutlet UIButton *login_Button; @property(nonatomic,retain) IBOutlet UITextField *username_TextField; @property(nonatomic,retain) IBOutlet UITextField *password_TextField; @property(nonatomic,retain) RootViewController *mc1; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @property(nonatomic,retain)Menu *mv1; - (IBAction)Login_Method:(id)sender; -(id)initWithUserName:(NSString *)name ; @end loginController.m #import "LoginController.h" #import "Menu.h" #import "ViewController.h" #import "RootViewController.h" @implementation LoginController @synthesize mc1,mv1; @synthesize login_Button,username_TextField,password_TextField; @synthesize navigationController; // Implement viewDidLoad to do additional setup after // loading the view, typically from a nib. - (void)viewDidLoad { if (![self.navigationController isNavigationBarHidden]) [self.navigationController setNavigationBarHidden:YES animated:NO]; //[self presentModalViewController:navigationController animated:YES]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (IBAction)Login_Method:(id)sender { Menu *mv2 = [[Menu alloc] initWithUserName:@"Menu" bundle:nil]; //mv2.l1.text=@"aa"; //i tried this, but not work,so created initWithUserName self.mv1=mv2; [self presentModalViewController:mv1 animated:YES]; // [RootViewController release]; } -(id)initWithUserName:(NSString *)name { self = [super init]; if (nil == self) { return nil; } // display or store login info somewhere [mv1.l1 setText:name]; return self; } -(BOOL)textFieldShouldReturn:(UITextField *)theTextField { [theTextField resignFirstResponder]; return YES; } - (void)dealloc { [username_TextField release]; [password_TextField release]; [super dealloc]; } @end Menu.h #import <UIKit/UIKit.h> @class Menu; @interface Menu : UIViewController { UILabel *l1; UIButton *AccountSummary_Button; UIButton *PayOffQuote_Button; UIButton *PayBill_Button; UIButton *Logout_Button; UINavigationController *nv1; } @property(nonatomic,retain) IBOutlet UILabel *l1; @property(nonatomic,retain) IBOutlet UIButton *AccountSummary_Button; @property(nonatomic,retain) IBOutlet UIButton *PayOffQuote_Button; @property(nonatomic,retain) IBOutlet UIButton *PayBill_Button; @property(nonatomic,retain) IBOutlet UIButton *Logout_Button; @property (nonatomic, retain) IBOutlet UINavigationController *nv1; -(IBAction)ViewAccountSummary_method:(id)sender; -(IBAction)ViewPayOffQuote_method:(id)sender; -(IBAction)ViewPayBill_method:(id)sender; -(IBAction)Logout_method:(id)sender; @end Menu.m

    Read the article

  • popView from UITabBarController inside UINavigationController

    - by Manu
    Hi, I'm building an application based on the Utility template from Xcode, to which I have added some more views. My application structure would be as follows: MainView (the app menu) Flip-side view (a calculator) UINavigationController Settings view viewDiDLoad: UITabBarController - Tab1 view (options) - Tab2 view (information text) I can navigate correctly from my MainView to my Flip-side view, which is also the root view of the Navigation Controller. From my Flip-side view, I push a second view of my Navigation Controller (Settings view) that is configured to show an UITabBarController, with two tabs, as soon as it loads (with viewDidLoad). If I remove the UITabBarController, I can return with no problems to my Flip-side view using "popViewController" from my Settings view. The problem comes if I load the UITabBarController in viewDiDLoad in my Settings view... the tabs work perfectly, but I'm not able to return to my Flip-side view (root view of the Navigation Controller) anymore. I CAN return if I use the Navigation Bar of the Navigation Controller, but I want to configure my own buttons and have the Navigation Bar hidden. So far I've tried the following methods: [self.navigationController popViewControllerAnimated:YES]; [self.navigationController popToRootViewControllerAnimated:YES]; [self.navigationController popToViewController:FlipSideViewController animated:YES]; But they don't seem to work. The first two just do nothing (the screen remains as it was), and the third one does not recognize the "FlipsideViewController" (maybe because it's a delegate of the MainViewController?). Is there a way to check what is exactly doing the "back" button of the Navigation Bar if I activate it? Should I be using delegates? Can I call a popViewController method in my Settings view from any of the two Tab views? This is my Flip-side view: - (IBAction)showSettingsView { SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@"SettingsView" bundle:nil]; controller.title = @"Settings"; [self.navigationController pushViewController:controller animated:YES]; [controller release]; } This is my Settings view: - (void)viewDidLoad { [super viewDidLoad]; tabBarController = [[UITabBarController alloc] init]; Tab1ViewController* vc1 = [[Tab1ViewController alloc] init]; Tab2ViewController* vc2 = [[Tab2ViewController alloc] init]; NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil]; tabBarController.viewControllers = controllers; [self.view addSubview:tabBarController.view]; } And the method to return in one of the Tab views: - (IBAction)backFromTab1View { [self.navigationController popToViewController:FlipSideViewController animated:YES]; } Thanks very much and sorry if the question is too basic!

    Read the article

  • copied the reachability-test from apple, but the linker gives a failure

    - by nico
    i have tried to use the reachability-project published by apple to detect a reachability in an own example. i copied the most initialization, but i get this failure in the linker: Ld build/switchViews.build/Debug-iphoneos/test.build/Objects-normal/armv6/test normal armv6 cd /Users/uid04100/Documents/TEST setenv IPHONEOS_DEPLOYMENT_TARGET 3.1.3 setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk -L/Users/uid04100/Documents/TEST/build/Debug-iphoneos -F/Users/uid04100/Documents/TEST/build/Debug-iphoneos -filelist /Users/uid04100/Documents/TEST/build/switchViews.build/Debug-iphoneos/test.build/Objects-normal/armv6/test.LinkFileList -dead_strip -miphoneos-version-min=3.1.3 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/uid04100/Documents/TEST/build/switchViews.build/Debug-iphoneos/test.build/Objects-normal/armv6/test Undefined symbols: "_SCNetworkReachabilitySetCallback", referenced from: -[Reachability startNotifer] in Reachability.o "_SCNetworkReachabilityCreateWithAddress", referenced from: +[Reachability reachabilityWithAddress:] in Reachability.o "_SCNetworkReachabilityScheduleWithRunLoop", referenced from: -[Reachability startNotifer] in Reachability.o "_SCNetworkReachabilityGetFlags", referenced from: -[Reachability connectionRequired] in Reachability.o -[Reachability currentReachabilityStatus] in Reachability.o "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from: -[Reachability stopNotifer] in Reachability.o "_SCNetworkReachabilityCreateWithName", referenced from: +[Reachability reachabilityWithHostName:] in Reachability.o ld: symbol(s) not found collect2: ld returned 1 exit status my delegate.h: import @class Reachability; @interface testAppDelegate : NSObject { UIWindow *window; UINavigationController *navigationController; Reachability* hostReach; Reachability* internetReach; Reachability* wifiReach; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @end my delegate.m: import "testAppDelegate.h" import "SecondViewController.h" import "Reachability.h" @implementation testAppDelegate @synthesize window; @synthesize navigationController; (void) updateInterfaceWithReachability: (Reachability*) curReach { if(curReach == hostReach) { BOOL connectionRequired= [curReach connectionRequired]; if(connectionRequired) { //in these brackets schould be some code with sense, if i´m getting it to run } else { } } if(curReach == internetReach) { } if(curReach == wifiReach) { } } //Called by Reachability whenever status changes. - (void) reachabilityChanged: (NSNotification* )note { Reachability* curReach = [note object]; NSParameterAssert([curReach isKindOfClass: [Reachability class]]); [self updateInterfaceWithReachability: curReach]; } (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch // Observe the kNetworkReachabilityChangedNotification. When that notification is posted, the // method "reachabilityChanged" will be called. // [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:) name: kReachabilityChangedNotification object: nil]; //Change the host name here to change the server your monitoring hostReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain]; [hostReach startNotifer]; [self updateInterfaceWithReachability: hostReach]; internetReach = [[Reachability reachabilityForInternetConnection] retain]; [internetReach startNotifer]; [self updateInterfaceWithReachability: internetReach]; wifiReach = [[Reachability reachabilityForLocalWiFi] retain]; [wifiReach startNotifer]; [self updateInterfaceWithReachability:wifiReach]; [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } (void)dealloc { [navigationController release]; [window release]; [super dealloc]; } @end

    Read the article

  • Why is my Interface Builder wiring so bonkers and what can I do to straighten it out?

    - by editor
    I've been working on an iPhone application in XCode and Interface Builder of the Tab Bar project type. After getting a table view of topics (business sectors) working fine I realized that I would need to add a Navigation Control to allow the user to drill into a subtopics (subsectors) table. As a green Objective-C developer, that was confusing, but I managed to get it working by reading various documentation trying out a few different IB options. My current setup is a Tab Bar Controller with Tab 1 as a Navigation Controller and Tab 2 a plain view with a Table View placed into it. The wiring works: I can log when table rows are selected and I'm ready to push a new View Controller onto the stack so that I can display the subtopics Table View. My problem: For some reason the first tab's Table View is a delegate and dataSource of the second ta. It doesn't make sense to me and I can't figure out why that's the only setup that works. Here is the wiring: Navigation Controller (Sectors) is a delegate of Tab Bar Navigation Bar is a delegate of Navigation Controller (Sectors) View Contoller (Sectors) has a view of Table View Table View (in Navigation Controller (Sectors)) is a delegate of First View Controller (Companies) Table View (in Navigation Controller (Sectors)) is a dataSource outlet of First View Controller (Companies) First View Controller (Companies) First View Contoller (Sectors) has a view of Table View Table View (in First View Controller (Companies)) is not hooked up to a dataSource outlet and is not a delegate When I click the tab buttons and look at the Inspector I see that the first tab is correctly hooked up to my MainWindow.xib and the second tab has selected a nib called SecondView.xib. It's in the File's Owner of MainWindow.xib where I inherit UITableViewDataSource and UITableViewDelegate (and also UITabBarControllerDelegate) in the .h, and in the .m where I implement the delegate methods. Why does this setup only work when the Table View in my first tab (View Controller (Sectors)) is a delegate and dataSource of the second tab? I'm confused: why wouldn't it need to be hooked up to the Navigation Controller-enabled tab in which the Table View is seen (Navigation Controller (Sectors))? The Table View seen on the second tab has neither dataSource and is not a delegate. I'm having trouble getting a pushViewController to fire (self.navigationController is not nil but the new View Controller still doesn't load) and I suspect that I need to work out this IB wiring issue before I can troubleshoot why the Nav Controller won't push a new View Controller onto the stack. if(nil == self.navigationController) { NSLog(@"self.navigationController is nil."); } else { NSLog(@"self.navigationController is not nil."); SectorList *subsectorViewController = [[SectorList alloc] initWithNibName:@"SectorList" bundle:nil]; subsectorViewController.title = @"Subsectors"; [[self navigationController] pushViewController:subsectorViewController animated:YES]; [subsectorViewController release]; }

    Read the article

  • iPhone: Grouped tables and navigation controller issues

    - by Jack Griffiths
    Hi there, I've set up a grouped table on my app, and pushing to new views works fine. Except for one thing. The titles and stack layout are all weird. Here's the breakdown: I have two sections in my table. When I tap on the first row in the first section, it takes me to the correct view, but the title of the new view is the name of the first row in the second section of the table. In turn, the second row in the first section's title is the second row in the second section's title. If I tap on the second row in the second section of the root view table, the navigation button goes to the second row in the first section of the table. So here's a diagram of my table: Table Section 1 Row 1 Row 2 Row 3 Table Section 2 Row A Row B Row C So if I tap on row 3, the title of the pushed view is Row C. The navigation button tells me to go back to Row 3, then eventually ending up at the root view. Here's my implementation file pushing the views: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //CSS if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"CSS"]) { CSSViewController *css = [[CSSViewController alloc] initWithNibName:@"CSSViewController" bundle:nil]; [css setTitle:@"CSS"]; [self.navigationController pushViewController:css animated:YES]; } //HTML if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"HTML"]) { HTMLViewController *html = [[HTMLViewController alloc] initWithNibName:@"HTMLViewController" bundle:nil]; [html setTitle:@"HTML"]; [self.navigationController pushViewController:html animated:YES]; } //JS if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"JavaScript"]) { JSViewController *js = [[JSViewController alloc] initWithNibName:@"JSViewController" bundle:nil]; [js setTitle:@"JavaScript"]; [self.navigationController pushViewController:js animated:YES]; } //PHP if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"PHP"]) { PHPViewController *php = [[PHPViewController alloc] initWithNibName:@"PHPViewController" bundle:nil]; [php setTitle:@"PHP"]; [self.navigationController pushViewController:php animated:YES]; } //SQL if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"SQL"]) { SQLViewController *sql = [[SQLViewController alloc] initWithNibName:@"SQLViewController" bundle:nil]; [sql setTitle:@"SQL"]; [self.navigationController pushViewController:sql animated:YES]; } & the array feeding the table's data: - (void)viewDidLoad { [super viewDidLoad]; arryClientSide = [[NSArray alloc] initWithObjects:@"CSS",@"HTML",@"JavaScript",nil]; arryServerSide = [[NSArray alloc] initWithObjects:@"Objective-C", @"PHP",@"SQL",nil]; // arryResources = [[NSArray alloc] initWithObjects:@"HTML Colour Codes", @"Useful Resources", @"About",nil]; self.title = @"Select a Language"; [super viewDidLoad]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } Any help would be greatly appreciated. Jack

    Read the article

  • Looking for Reachability (2.0) Use Case Validation

    - by user350243
    There is so much info out there on using Apple's Reachability example, and so much is conflicting. I'm trying to find out of I'm using it (Reachability 2.0) correctly below. My App use case is this: If an internet connection is available through any means (wifi, LAN, Edge, 3G, etc.) a UIButton ("See More") is visible on various views. If no connection, the button is not visible. The "See More" part is NOT critical in any way to the app, it's just an add-on feature. "See More" could be visible or not anytime during the application lifecycle as connection is established or lost. Here's how I did it - Is this correct and/or is there a better way? Any help is Greatly Appreciated! lq // AppDelegate.h #import "RootViewController.h" @class Reachability; @interface AppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UINavigationController *navigationController; RootViewController *rootViewController; Reachability* hostReach; // NOT USED: Reachability* internetReach; // NOT USED: Reachability* wifiReach; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @property (nonatomic, retain) IBOutlet RootViewController *rootViewController; @end // AppDelegate.m #import "AppDelegate.h" #import "Reachability.h" #define kHostName @"www.somewebsite.com" @implementation AppDelegate @synthesize window; @synthesize navigationController; @synthesize rootViewController; - (void) updateInterfaceWithReachability: (Reachability*) curReach { if(curReach == hostReach) { NetworkStatus netStatus = [curReach currentReachabilityStatus]; BOOL connectionRequired = [curReach connectionRequired]; // Set a Reachability BOOL value flag in rootViewController // to be referenced when opening various views if ((netStatus != ReachableViaWiFi) && (netStatus != ReachableViaWWAN)) { rootViewController.bConnection = (BOOL *)0; } else { rootViewController.bConnection = (BOOL *)1; } } } - (void) reachabilityChanged: (NSNotification* )note { Reachability* curReach = [note object]; NSParameterAssert([curReach isKindOfClass: [Reachability class]]); [self updateInterfaceWithReachability: curReach]; } - (void)applicationDidFinishLaunching:(UIApplication *)application { // NOTE: #DEFINE in Reachability.h: // #define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification" [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:) name: kReachabilityChangedNotification object: nil]; hostReach = [[Reachability reachabilityWithHostName: kHostName] retain]; [hostReach startNotifer]; [self updateInterfaceWithReachability: hostReach]; [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } - (void)dealloc { [navigationController release]; [rootViewController release]; [window release]; [super dealloc]; } @end

    Read the article

  • Tab Bar and Nav Controller: Where did I go wrong in my Interface Builder wiring?

    - by editor
    Even if you don't know how I've shot myself in the foot, a story which I've tried to lay out below, if you think I've done a good job showing the parameters of my problem I'd appreciate an upvote so that I might be able to grab some attention for my question. I've been working on an iPhone application in XCode and Interface Builder of the Tab Bar project type. After getting a table view of topics (business sectors) working fine I realized that I would need to add a Navigation Control to allow the user to drill into a subtopics (subsectors) table. As a green Objective-C developer, that was confusing, but I managed to get it working by reading various documentation trying out a few different IB options. My current setup is a Tab Bar Controller with Tab 1 as a Navigation Controller and Tab 2 a plain view with a Table View placed into it. The wiring works: I can log when table rows are selected and I'm ready to push a new View Controller onto the stack so that I can display the subtopics Table View. My problem: For some reason the first tab's Table View is a delegate and dataSource of the second ta. It doesn't make sense to me and I can't figure out why that's the only setup that works. Here is the wiring: Navigation Controller (Sectors) is a delegate of Tab Bar Navigation Bar is a delegate of Navigation Controller (Sectors) View Contoller (Sectors) has a view of Table View Table View (in Navigation Controller (Sectors)) is a delegate of First View Controller (Companies) Table View (in Navigation Controller (Sectors)) is a dataSource outlet of First View Controller (Companies) First View Controller (Companies) First View Contoller (Sectors) has a view of Table View Table View (in First View Controller (Companies)) is not hooked up to a dataSource outlet and is not a delegate When I click the tab buttons and look at the Inspector I see that the first tab is correctly hooked up to my MainWindow.xib and the second tab has selected a nib called SecondView.xib. It's in the File's Owner of MainWindow.xib where I inherit UITableViewDataSource and UITableViewDelegate (and also UITabBarControllerDelegate) in the .h, and in the .m where I implement the delegate methods. Why does this setup only work when the Table View in my first tab (View Controller (Sectors)) is a delegate and dataSource of the second tab? I'm confused: why wouldn't it need to be hooked up to the Navigation Controller-enabled tab in which the Table View is seen (Navigation Controller (Sectors))? The Table View seen on the second tab has neither dataSource and is not a delegate. I'm having trouble getting a pushViewController to fire (self.navigationController is not nil but the new View Controller still doesn't load) and I suspect that I need to work out this IB wiring issue before I can troubleshoot why the Nav Controller won't push a new View Controller onto the stack. if(nil == self.navigationController) { NSLog(@"self.navigationController is nil."); } else { NSLog(@"self.navigationController is not nil."); SectorList *subsectorViewController = [[SectorList alloc] initWithNibName:@"SectorList" bundle:nil]; subsectorViewController.title = @"Subsectors"; [[self navigationController] pushViewController:subsectorViewController animated:YES]; [subsectorViewController release]; }

    Read the article

  • cant show MBProgressHUD

    - by dejoong
    In here said that using MBProgressHUD is easy. But i cant make it. Here my code: - (IBAction)save{ HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; [self.navigationController.view addSubview:HUD]; HUD.delegate = self; [HUD show:YES]; NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"]; SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title]; [savePage save]; [HUD hide:YES]; } the progress indicator not show during [savePage save] method run, but show after the page completely saved (the indicator show for less than 1 second). I also tried this way: - (IBAction)save { HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; [self.navigationController.view addSubview:HUD]; HUD.delegate = self; HUD.labelText = @"Saving..."; [HUD showWhileExecuting:@selector(performFetchOnMainThread) onTarget:self withObject:nil animated:YES]; } - (void) savingPage{ NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"]; SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title]; [savePage save]; } -(void) performFetchOnMainThread { [self performSelectorOnMainThread:@selector(savingPage) withObject:nil waitUntilDone:YES]; } but still no luck. Anyone let me know where im lack here?? P.S [savePage save] is saving all website contents to local directory. I wish once the saving is complete the progressHUD disappear. Thanks

    Read the article

  • UINavigationController placement problem

    - by Chonch
    Hey, I'm having this problem and I can't seem to figure out why! I want to use a UINavigationController, but I don't want to use it through out the entire application. So, in the UIViewController I was to add it to, I define: UINavigationController *navigationController; and the @property, @synthesize and dealloc. In the viewDidLoad method, I add: navigationController = [[UINavigationController alloc] init]; navigationController.navigationBar.barStyle = UIBarStyleBlack; and when the relevant UIViewController is loaded, I add: [navigationController pushViewController:viewController animated:NO]; and make the old view disappear and the UINavigationController's view to appear. Everything works fine except that the navigation bar appears about 20pixels too low (dragging the entire view down and out of the screen). If I set the UINavigationController's view frame parameter manually to start at 0,0, it jumps there, but only after about a second, so that you can see the navigation bar starting at a certain location and only then jumping to another (and it is ugly!). I have done the exact same thing in the past and had no problem with it. Does anyone know what may cause this? Thanks,

    Read the article

  • Problem pushing multiple view controllers onto navigation controller stack

    - by Jim
    Hi, I am trying to push three view controllers onto the navigation controller. [self.navigationController pushViewController:one animated:YES]; [self.navigationController pushViewController:two animated:YES]; [self.navigationController pushViewController:three animated:YES]; The desired behavior is that view three will show, and when the back button is pressed it will go to view two and then to view one... What actually happens is that view one is visible and pressing back goes to view two and then back again it goes to view one. Which is to say that view one is shown instead of view three. Very strangely, looking at the viewController array of the navigationController after the calls above show the right entries, and looking at the visibleViewController property shows that it has view three in it... even though view one is visible. If i navigate to a sub view from the visible view one (that shows in the place of view three) and press back from that sub view... it goes to view three. It looks like it is showing view one, but knows it is on view three... I am completely confused... any ideas? Jim

    Read the article

  • Default update detailViewController, HELP.

    - by DrBeak1
    I've created an app that allows users to add information (from an addViewController), which is then displayed in a UITableView on the rootViewController. When the user taps the tableViewCell the detailViewController then displays, you guessed it, more details regarding the inputted user information. What I'm trying to accomplish is to setup an editViewController that will allow users to edit information they've already submitted. Currently, I'm trying to auto-populate the editViewController with the information that was previously submitted by the user (after which they can press save and update the info). However, I'm getting stuck trying to perform this auto-populating and I'm not sure this is even the best route to accomplish this. Here is the edit method that is called to load the editViewController from the detailViewController. -(IBAction)editDetails:(id)sender { editViewController *evc = [[editViewController alloc] initWithNibName:@"editViewController" bundle:nil]; rootViewController *rvc = [[rootViewController alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:evc]; [[self navigationController] presentModalViewController:navigationController animated:YES]; ///For Style NSInteger styleCount = [[rvc scoreTypeArray] count]; NSInteger styleRows = [rvc.scoreTypeArray objectAtIndex:indexPath.row]; ///HERE I GET AN ERROR MESSAGE SAYING THAT indexPath IS NOT DEFINED ///For Date NSInteger count = [[rvc dateArray] count]; NSInteger rows = [[rvc indexPath] row]; ///AND HERE I GET A WARNING MESSAGE SAYING rootViewController MAY NOT RESPOND TO INDEX PATH, AND OF COURSE IT DOESN'T WORK [[evc dateField] setText:[NSString stringWithFormat:@"%@", [[evc dateArray] objectAtIndex:(count-1-rows)]]]; [[evc styleField] setText:[NSString stringWithFormat:@"%@", [[rvc scoresArray] objectAtIndex:(styleCount-1-styleRows)]]]; [navigationController release]; [evc release]; [rvc release];} So here I'm trying to load the information from a saved array that is declared in my rootViewController. Any thoughts any body? Please and thank you : )

    Read the article

  • View Controller Question

    - by user341444
    First off I'm new at programming. I'm creating an app with one navigation bar controller. The app is pretty basic except for a quiz section that is comprised of 12 xibs. As the users takes the quiz a new xib is pushed onto the stack. I want to create a button that takes the user back to the home screen if they do not want to complete the quiz. The back button takes them to the previous xib which could be 11 deep. Is it possible to dismiss the modal views and reload the rootView controller? Here's the code from my delegate @synthesize window; @synthesize navigationController; (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } (void)dealloc { [window release]; [navigationController release]; [super dealloc]; } This is how I'm pushing new xibs onto the stack (IBAction) showTesting: (id)sender { Testing *varTesting = [[[Testing alloc] initWithNibName:@"Testing" bundle:nil] autorelease]; [[self navigationController] pushViewController:varTesting animated: YES]; } Any help would be greatly appreciated. Thanks

    Read the article

  • How i pass my view to nib at run time(Dynamically) in viewController class?

    - by Rajendra Bhole
    Hi, I want to create viewController class programmatically in which the view of nib file of viewController is not fixed. I have a UntitledViewController class that contains 4 UIButtons: -(IBAction)buttonPressed:(id)sender{ if((UIButton *)sender == button1){ tagNumber = button1.tag; NewViewController *newVC = [[NewViewController alloc] init]; //newVC.tagN [self.navigationController pushViewController:newVC animated:YES]; NSLog(@"Button Tag Number:- %i", tagNumber); } if((UIButton *) sender == button2){ tagNumber = button2.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button3){ tagNumber = button3.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button4){ int x = tagNumber; tagNumber = button4.tag; NewViewController *newVC = [[NewViewController alloc] init]; newVC.untitledVC = self; [self.navigationController pushViewController:newVC animated:YES]; } } When I will click any one of the UIButtons, I want to create a new NewViewController class with button tag property but without fixed nib file. In NewViewController's loadView event I want to fix the view of the nib of NewViewController class using UIButton's tag property (In NewViewController.xib I'm creating 4 UIViews named view1, view2, view3 and view4). -(void)loadView{ [super loadView]; CGRect frame = CGRectMake(0, 0, 320, 480); UIView *newView = [[UIView alloc] initWithFrame:frame]; newView.tag = untitledVC.tagNumber; self.view1 = newView; } Now I want that when I click button1 the NewViewController will be generated with view1 and when I click button2 the NewViewController will be generated with view2 and so on with different implementation. Thanks.

    Read the article

  • Nested modal view controller gives strange message under iOS6?

    - by user1840362
    I am presenting a modal view controller from another modal view controller, and this worked fine under all iOS versions prior to iOS6. But under iOS6 I am getting the following warning message in the emulator: Warning: Attempt to present <UINavigationController: 0x14e93680> on <UINavigationController: 0x9fc6b70> while a presentation is in progress! The modal view controller is not shown if this warning appears. Basically I am using code like this to show the modal view controller: WebAuthViewController *authController = [[WebAuthViewController alloc] initWithNibName:nil bundle:nil]; authController.challenge = challenge; authController.delegate = self; UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:authController]; [self presentModalViewController:aNavController animated:YES]; [aNavController release]; [authController release]; The view that is already shown is a UIWebView also shown in a modal view, like this: WebViewController *addController = [[WebViewController alloc] initWithNibName:nil bundle:nil]; addController.urlToLoad = [NSURL URLWithString:urlString]; addController.delegate = self; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addController]; navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:navigationController animated:YES]; [navigationController release]; [addController release]; The apple docs still suggest that one is supposed to be able to stack navigation controllers like this, so I am at a loss to explain why this happens. Any hints?

    Read the article

  • Reference from UITableViewCell to UITableView to UINavigationController

    - by Nick
    If the user taps and holds on a Foo table view cell for 2 seconds, a modal view should be shown. The modal view is also displayed when a new Foo is added to the cell. The modal view's delegate protocol is implemented by the parent UITableView subclass. My tap and hold detection code is in the Foo UITableViewCell class. I'm having difficulty referencing the parent tableview's navigation controller to display the modal view. FooModalViewController *modalController = [[FooModalViewController alloc] initWithNibName:@"FooModalViewController" bundle:nil]; FooTableViewController *tableView = (FooTableViewController *) self.superview; foo.delegate = tableView; Seems OK but I'm having problems referencing the navigation controller that contains the tableview.. The code below builds OK but throws an exception - NSOBject DoesNotRecognizeSelector. UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController]; [[tableView.navigationController] presentModalViewController:navigationController animated:YES]; I think that perhaps my design is flawed..?

    Read the article

  • Doesn't [UIWindow addSubView:] retain?

    - by Dan Ray
    Check it: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSLog(@"Checking login--user value is %@", [defaults valueForKey:@"userID"]); if ([defaults valueForKey:@"userID"] == NULL){ LoginViewController *loginController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil]; [window addSubview:loginController.view]; [loginController release]; } else { [window addSubview:[navigationController view]]; } Every other place when I put a subview into another view, I release that view after I've done that, because it's now owned by the view it's a subview of. HERE, though, when I do [loginController release], every IBAction on that loginController gets called against a deallocated instance. Commenting out that line makes everything work. I note the difference in approach between my loginController and the navigationController that came with the template; the navigationController is a synthesized property that gets released in -(void)dealloc{ }, so it's still around after being put into window.

    Read the article

  • touchesBegan and other touch events not getting detected in UINavigationController

    - by SaltyNuts
    In short, I want to detect a touch on the navigation controller titlebar, but having trouble actually catching any touches at all! Everything is done without IB, if that makes a difference. My app delegate's .m file contains: MyViewController *viewController = [[MyViewController alloc] init]; navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; [window addSubview:navigationController.view]; There are a few other subviews added to this window in a way that overlays navigationController leaving only the navigation bar visible. MyViewController is a subclass of UIViewController and its .m file contains: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { NSLog(@"ended\n"); } } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { NSLog(@"began\n"); } } I also tried putting these functions directly into app delegate's .m file, but the console remains blank. What am I doing wrong?

    Read the article

  • Presentmodalviewcontroller method problem with retain count

    - by Infinity
    Hello guys! I am trying to present a modal view controller. I have read the documentation, but something is strange. Here's my code: NSLog(@"rc: %d", [modalViewController retainCount]); UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalViewController]; [self presentModalViewController:navigationController animated:YES]; [navigationController release]; NSLog(@"rc: %d", [modalViewController retainCount]); And on the console, appears: rc: 2 rc: 24 And I think 24 is very strange... What do you thin? Why is this happening?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >