Search Results

Search found 250 results on 10 pages for 'uitabbarcontroller'.

Page 10/10 | < Previous Page | 6 7 8 9 10 

  • "modal" in apple documentation

    - by Crystal
    Apple uses "modal" often in their documentation. Like dismissModalViewController in their titles of methods, or documentation like: "The UIViewController class provides the fundamental view-management model for iPhone applications. The basic view controller class supports the presentation of an associated view in addition to basic support for managing modal views and rotating views in response to device orientation changes. Subclasses such as UINavigationController and UITabBarController provide additional behavior for managing complex hierarchies of view controllers and views." I'm not sure as to what context I should think of when I see modal in the names and documentation. Any thoughts? Thanks.

    Read the article

  • rootview controller in Interface builder?

    - by senthilmuthu
    hi, i have done in didapplicationfinishing function tabBarController = [[UITabBarController alloc] init] ; tabBarController.navigationItem.title = @"News"; SimpleTableViewController *rtbfViewController = [[SimpleTableViewController alloc] init]; //initWithStyle:UITableViewStyleGrouped]; rtbfViewController.tabBarItem.title = @"News1"; rtbfViewController.tabBarItem.image = [UIImage imageNamed:@"home.png"];; UINavigationController *table2NavController = [[[UINavigationController alloc] initWithRootViewController:rtbfViewController] autorelease]; [rtbfViewController release]; it works fine .suppose if i have Navigation controller in Interface Builder,how can i set initWithRootViewController in Interface builder?

    Read the article

  • UITabbar without controller

    - by Etienne
    Hello. I have a simple app where the only view controller has an outlet to a UITabBar. It also implements UITabBarDelegate and is set as the delegate for the UITabBar: @interface TheMainViewController : UIViewController <UITabBarDelegate> { IBOutlet UITabBar *theTabBar; } I implemented the following method Which gets called whenever any of my 4 UITabBarItems get tapped. I tried just doing something really simple: - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { tabBar.selectedItem = [tabBar.items objectAtIndex:0]; return; } In theory, it should always stay selected on my first tab and it works perfectly when I just tap any UITabBarItem (nothing happens, the first one always stays selected). But when I touch a UITabBarItem and hold it (not taking my finger off) the selection changes anyway ! Debugging, everything gets called properly. It's like changing the selectedItem property doesn't have any effect is the user still has the item "down" (with his finger on it). What would be a good workaround? I tried overloading UITabBar and messing with touchesBegan and touchesEnd but they don't even get called. Same with UITabBarItem. Oh and please don't suggest using a UITabBarController as it is not flexible enough for my application. So frustrating....thanks!

    Read the article

  • UINavigationController inside tabbar loading a child root view

    - by Doug
    Hi guys, Firstly i'll preface by saying that i am a complete Cocoa touch/objective c noob (.Net dev having a dabble) I have searched on Google as well as here but cannot seem to find an easy solution. I have a UItabbarcontroller view with a UINavigationController inside its first tab I have the root view for this UINavigationController stored in a seperate class and NIB as i am trying to seperate the data viewing from the data loading (i'm going to reuse the table list in multiple places in my database) and simply pass the root view its data using a loading method and have it take it from there. What i want to happen: App loads and loads the first view of the tab bar (A UINavigationController) The UINavigationController inside the first view loads a root view (a UIViewController with a table view) and sets its title The UINavigationController loads the data from a web service and parses it The UINavigationController sends the data to a loading method inside the UIViewController Am i thinking about this completely wrongly? What currently happens: the first tab bar loads with an empty uinavigationcontroller (no table view) the data methods fire and get the webservice data this child view gets sent its data using the loading method the tableview delegate events fail to fire inside the child view telling it to load the data into the table I just can't seem how to load my second view inside the root view of the navigation controller and then send it my data?

    Read the article

  • Stanford iPhone dev Paparazzi 1 setup help

    - by cksubs
    Hi, I'm having trouble using a tab bar control. Basically, when I build and run I'm just getting the blank white default "Window" screen. I was following this guide: http://www.iphoneosdevcafe.com/2010/03/assignment-4-part-1/#comment-36 Drag a Tab Bar Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Tab Bar Controller. Drag a Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. Drag a second Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. This completes all the connections between the App Delegate and the tab bar and two navigation controllers. By using IB to set up the tab bar and navigation controllers in this way, you need not allocate and init the controllers in AppDelegate.m. When you build and run this, you will see the tab bar controller and two navigation controllers. Is there a step there that he missed? How do I hook the Tab Bar Controller up to the Window? EDIT: Do I need to do something like this? mainTabBar = [[UITabBarController alloc] init]; [window addSubview:mainTabBar.view]; That's still not working, but I feel like I'm on the right track? Why can't this all be done from Interface Builder?

    Read the article

  • adding tabbar to uiview (not tabbarcontroller) to switch views

    - by Pavan
    Hi, i added a Tab bar to my existing view called secondViewController where there are now 4 tab bar items using interface builder. This tab bar will allow the users to switch between views. This is what ive tried to do: If i use a tabbar controller, then a new view pops up and i dont want that. i simply want to be able to add a tab bar as ive done and carry on from there. i dont know how to actually connect it all up and make everything work together. This is what i understand: i have to make my current - secondViewController an tabbardelegate which is what ive done as shown @interface paddedDholViewController : UIViewController <AVAudioPlayerDelegate, UITabBarDelegate> { } then i understand that i have to add tabBar.delegate = self; for me to be able to detect the tabBar:didSelectItem: so i can then implement something like this - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { if ([viewController.tabBarItem.title isEqualToString:@"FIRST"]) { NSLog(@"FIRST"); } else if ([viewController.tabBarItem.title isEqualToString:@"SECOND"]) { NSLog(@"SECOND"); } } to be able to switch between the views The thing is as ive said before i dont know how to implement all of this and how to connect everything up. can someone help me please. Thank you in advance

    Read the article

  • Iphone application crashes when poping to rootController of UITabBar tab

    - by sniurkst
    Hello, I'm having this bug I can't figure out and it is making my head hurt. So, basically, in my iphone application I have UITabBar with some tabs each having UINavigationControllers inside. Something like this: someViewController *someController = [[someViewController alloc] myInit]; UINavigationController *someNav = [[UINavigationController alloc] initWithRootViewController:someController]; tab = [[UITabBarController alloc] init]; tab.viewControllers = [NSArray arrayWithObjects:otherNav, otherNav, evilNav, nil]; [window addSubview:tab.view]; So to reproduce my "precious" bug I go like this: click evilNav tab -> push tableListView (category list) -> push otherTableListView (category items list) -> push someOtherView (single item) -> popToRoot || popToController withindex:0 || click on evilNav tab again || pop to otherTableListView -> pop to tableListView -> crash (with no notable error) So if I go so far to someOtherView I can't go back to first tableListView (rootViewController) without application crashing. Meanwhile I can go to other tabs and then even click evilNav (when it is in otherTableListView or someOtherView state) without crashing. What could be causing this problem? (If you need I will post more code)

    Read the article

  • Strange UIKit bug, table view row stays selected

    - by Can Berk Güder
    I'm facing what appears to be a UIKit bug, and it takes the combination of two less commonly used features to reproduce it, so please bear with me here. I have quite the common view hierarchy: UITabBarController -> UINavigationController -> UITableViewController and the table view controller pushes another table view controller onto the navigation controller's stack when a row is selected. There's absolutely nothing special or fancy in the code here. However, the second UITableViewController, the "detail view controller" if you will, does two things: It sets hidesBottomBarWhenPushed to YES in its init method, so the tab bar is hidden when this controller is pushed: - (id)initWithStyle:(UITableViewStyle)style { if(self = [super initWithStyle:style]) { self.hidesBottomBarWhenPushed = YES; } return self; } It calls setToolbarHidden:NO animated:YES and setToolbarHidden:YES animated:YES on self.navigationController in viewWillAppear: and viewWillDisappear: respectively, causing the UIToolbar provided by UINavigationController to be displayed and hidden with animations: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController setToolbarHidden:NO animated:YES]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.navigationController setToolbarHidden:YES animated:YES]; } Now, if the second UITableViewController was pushed by selecting the row at the bottom of the screen (it doesn't have to be the last row) in the first controller, this row does not automatically get deselected when the user immediately or eventually returns to the first controller. Further, the row cannot be deselected by calling deselectRowAtIndexPath:animated: on self.tableView in viewWillAppear: or viewDidAppear: in the first controller. I'm guessing this is a bug in UITableViewController's drawing code which of course only draws visible rows, but unfortunately fails to determine correctly if the bottommost row will be visible in this case. I failed to find anything on this on Google or OpenRadar, and was wondering if anyone else on SO had this problem or knew a solution/workaround.

    Read the article

  • Setting an NSMutableArray in AppDelegate to be an NSMutableArray in

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

  • UISegmentedControl Best Practice

    - by Neal L
    Hi all, I'm trying to work out the "best" way to use a UISegmentedControl for an iPhone application. I've read a few posts here on stackoverflow and seen a few people's ideas, but I can't quite sort out the best way to do this. The posts I'm referring to are: http://stackoverflow.com/questions/1559794/changing-views-from-uisegmentedcontrol and http://stackoverflow.com/questions/1047114/how-do-i-use-a-uisegmentedcontrol-to-switch-views It would seem that the options are: Add each of the views in IB and lay them out on top of each other then show/hide them Create each of the subviews separately in IB, then create a container in the main view to populate with the subview that you need Set up one really tall or really wide UIView and animate it left/right or up/down depending on the selected segment Use a UITabBarController to swap out the subviews - seems silly For tables, reload the table and in cellForRowAtIndex and populate the table from different data sources or sections based on the segment option selected (not the case for my app) So which approach is best for subview/non-table approaches? Which is the easiest to implement? Could you share some sample code to the approach? Thanks!

    Read the article

  • Can I include a NSUserDefault password test in AppDelegate to load a loginView?

    - by Michael Robinson
    I have a name and password in NSUserDefaults for login. I want to place a test in my AppDelegate.m class to test for presence and load a login/signup loginView.xib modally if there is no password or name stored in the app. Here is the pulling of the defaults: -(void)refreshFields { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; usernameLabel.text = [defaults objectForKey:kUsernameKey]; passwordLabel.text = [defaults objectForKey:kPasswordKey]; Here is the tabcontroller loading part: - (void)applicationDidFinishLaunching:(UIApplication *)application { firstTab = [[FirstTab alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *firstNavigationController = [[UINavigationController alloc] initWithRootViewController:firstTab]; [firstTab release]; secondTab = // EDITED FOR SPACE thirdTab = // EDITED FOR SPACE tabBarController = [[UITabBarController alloc] init]; tabBarController.viewControllers = [NSArray arrayWithObjects:firstNavigationController, secondNavigationController, thirdNavigationController, nil]; [window addSubview:tabBarController.view]; [firstNavigationController release]; [secondNavigationController release]; [thirdNavigationController release]; [self logout]; [window makeKeyAndVisible]; Here is where the loginView.xib loads automatically: - (void)logout { loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil]; UINavigationController *loginNavigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController]; [loginViewController release]; [tabBarController presentModalViewController:loginNavigationController animated:YES]; [loginNavigationController release]; } I want to replace the above autoload with a test similar to below (that works) using IF-ELSE - (void)logout { if ([usernameLabel.text length] == 0 || [passwordLabel.text length] == 0) { loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil]; UINavigationController *loginNavigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController]; [loginViewController release]; [tabBarController presentModalViewController:loginNavigationController animated:YES]; [loginNavigationController release]; }else { [window addSubview:tabBarController.view];} Thanks in advance, I'm totally lost on this.

    Read the article

  • How does the overall view hierarchy change when using UIKit view manipulations?

    - by executor21
    I've been trying to figure out what happens in the view hierarchy when methods like pushViewController:animated, presentModalViewController:animated, and tab switches in UITabBarViewController are used, as well as UIAlertView and UIActionSheet. (Side note: I'm doing this because I need to know whether a specific UIView of my creation is visible on screen when I do not know anything about how it or its superview may have been added to the view hierarchy. If someone knows a good way to determine this, I'd welcome the knowledge.) To figure it out, I've been logging out the hierarchy of [[UIApplication sharedApplication] keyWindow] subviews in different circumstances. Is the following correct: When a new viewController is pushed onto the stack of a UINavigationController, the old viewController's view is no longer in the view hierarchy. That is, only the top view controller's view is a subview of UINavigationController's view (according to logs, it's actually several private classes such as UILayoutContainerView). Are the views of view controllers below the top controller of the stack actually removed from the window? A very similar thing happens when a new viewController is presented via presentModalViewController:animated. The new viewController's view is the only subview of the kew window. Is this correct? The easiest thing to understand: a UIAlertView creates its own window and makes it key. The strangest thing I encountered: a UIActionSheet is shown via showInView: method, the actionSheet isn't in the view hierarchy at all. It's not a subview of the view passed as an argument to showInView:, it isn't added as a subview of the key window, and it doesn't create its own window. How does it appear, then? I haven't tried this yet, so I'd like to know what happens in the keyWindow hierarchy when tabs in a UITabBarController are switched. Is the view of the selected UIViewController moved to the top, or does it work like with pushViewController:animated and presentModalViewController:animated, where only the displayed view is in the window hierarchy?

    Read the article

  • iPhone: Animating a view when another view appears/disappears

    - by MacTouch
    I have the following view hierarchy UITabBarController - UINavigationController - UITableViewController When the table view appears (animated) I create a toolbar and add it as subview of the TabBar at the bottom of the page and let it animate in with the table view. Same procedure in other direction, when the table view disappears. It does not work as expected. The animation duration is OK, but somehow not exact the same as the animation of the table view when it becomes visible When I display the table view for the second time, the toolbar does not disappear at all and remains at the bottom of the parent view. What's wrong with it? - (void)animationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { UIView *toolBar = [[[self tabBarController] view] viewWithTag:1000]; [toolBar removeFromSuperview]; } - (void)viewWillAppear:(BOOL)animated { UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 44, 0); [[self tableView] setContentInset:insets]; [[self tableView] setScrollIndicatorInsets:insets]; // Toolbar initially placed outside of the visible frame (x=320) UIView *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(320, 480-44, 320, 44)]; [toolBar setTag:1000]; [[[self tabBarController] view] addSubview:toolBar]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.35]; [toolBar setFrame:CGRectMake(0, 480-44, 320, 44)]; [UIView commitAnimations]; [toolBar release]; [super viewWillAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { UIView *toolBar = [[[self tabBarController] view] viewWithTag:1000]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.35]; [UIView setAnimationDidStopSelector:@selector(animationDone:finished:context:)]; [toolBar setFrame:CGRectMake(320, 480-44, 320, 44)]; [UIView commitAnimations]; [super viewWillDisappear:animated]; }

    Read the article

  • How do I reliably get the size of my iPhone view taking rotations into consideration?

    - by Sebastian Celis
    My application uses a UITabBarController, multiple UINavigationControllers, and supports autorotation. In order to properly layout the subviews within each UIViewController's main view, I really need to know the size available to the UIViewContoller. I need this size to take the UINavigationBar, the UITabBar, and the status bar all into account, and thus only return the size available to the content view. I thought for sure I could use the following from within the UIViewController's code: CGRect viewControllerBounds = [[self view] bounds]; However, there are a couple of issues with this approach: The first time the view is loaded, viewControllerBounds reports the view as being 320 pixels wide by 460 pixels tall. This is wrong. With a status bar and a navigation bar showing, the height should only be 416 pixels. However, if I rotate the simulator to landscape and then rotate back, the height of viewControllerBounds changes to 416. If I rotate the first view in the navigation controller to landscape mode and then push another view controller onto the stack, viewControllerBounds for the new view reports a width of 300 pixels and a height of 480 pixels. So the view's bounds didn't even take the rotation into account. Is there a better way to do this? I really don't want to have to start hardcoding the widths and heights of all the various UI elements the iPhone OS provides. I have tried setting the autoresizing mask of the UIViewController's view, but that doesn't seem to change anything. The views definitely seem to be displaying properly. When I set a background color that view looks like it takes up all of the space available to it. Any pointers would be greatly appreciated.

    Read the article

  • iPhone: Using a NSMutableArry in the AppDelegate as a Global Variable

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    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

  • UIView Login screen to tabbar logic

    - by Benjamin De Bos
    Folks, i'm having trouble with some navigation logic. Currently i have a simple two tabbed tabbar application. But i want to show a loginscreen in front. So that would be an UIView. Currently the code is as follows: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController *viewController1 = [[roosterViewController alloc] initWithNibName:@"roosterViewController" bundle:nil]; UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; self.tabBarController = [[UITabBarController alloc] init]; self.tabBarController.viewControllers = @[viewController1, viewController2]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; } SO this pushes a simple tabcontroller. Well, now i want to have a login screen. So that would be a simple UIView which pushes the tabbar controller. But i can't seem to see the logic on how to do this. I've been trying to present a modal view controller, but the thing is: the tabbar will be loaded on the background. Since i need the username/password information to work on the tabbarview, this won't work. My Logic would be: delegate load loginViewController load tabbar controller But, then i need to be able to "logout". So i need to destroy the tabbar controller and present the login screen. Any thoughts on this?

    Read the article

  • unclear use of @property in window app using core data

    - by Matt
    Looking through a Window based application ive used to experiment with as a way of getting my head around core data, ive noticed that the appdelegate has the following code myAppDelegate.h #import <UIKit/UIKit.h> #import <CoreData/CoreData.h> @interface iCaptureFreeAppDelegate : NSObject <UIApplicationDelegate> { NSManagedObjectModel *managedObjectModel; NSManagedObjectContext *managedObjectContext; NSPersistentStoreCoordinator *persistentStoreCoordinator; UIWindow *window; UITabBarController *tabBarController; } myAppDelegate.m #import "myAppDelegate.h" @interface iCaptureFreeAppDelegate (PrivateCoreDataStack) @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; @end @implementation iCaptureFreeAppDelegate @synthesize window, tabBarController; // code .... // - (NSManagedObjectContext *) managedObjectContext { } - (NSManagedObjectModel *)managedObjectModel { } - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { } // etc..... i want to understand a few things about what this project is doing why the properties in the category declaration? (if i delete the privateCoreDataStack category everything still works...) why the properties appear to be linked with the methods in the implementation ... managedObjectContext {} etc why the members in the .h file have the same name as the properties and the methods why code completion lets me use dot '.' to access the members but then fails on compilation say it cant find a getter thanks !

    Read the article

  • iPhone rotation woes

    - by skooter500
    I have been spending many frustrating hours trying to get rotations working on the iPhone version of Tunepal. Firstly, I have a tab bar controller, with a navigation controller controlling each of the views. I actually only want one of my views to be able to rotate and that is the TuneDisplay. I have a subclassed the UITabBarController and overridden theshouldAutorotateToInterfaceOrientation: (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { if (self.selectedViewController != nil) { return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } else { return (interfaceOrientation == UIInterfaceOrientationPortrait); } } In each of the view controllers for each of the tabs I have overridden the method and returned YES for each orientation I want to support. All well and good and everything works as it should. If I try and do a rotation on a tab that doesn’t support the rotation, nothing happens. The problem occurs if I move from a tab thats rotated to a tab that isnt supposed to support that rotation. The new tab is displayed rotated too! Screenshots for all this are included here: http://tunepal.wordpress.com/2010/04/20/rotation-woes/ Is there any way I can make it rotate back to portrait on tapping the tab? I have tried the unsupported setOrientation trick, but firstly it doesnt work correctly and secondly I received a warning from Apple for including it in my last build. If (as I suspect) there is no way to limit this behavior: How do I make the microphone image scale when I rotate the device? How do I make the buttons and the progress bar expand to fit the witdh of the toolbar? Also, one of the tabs that rotates ok has a table, with a search bar. The first time I rotate to the right or to the left, I get a black bar to the right of the search bar. If I subsequently rotate back and rotate again, the bar disappears! I have enabled the struts and springs things on the search bar in the interface builder and it looks like it should behave correctly. Any ideas about how to fix this? Ideas, feedback much appreciated Bryan

    Read the article

  • managedObjectContext question...

    - by treasure
    Hello, I have an app which is a UITabBarController, I have defined two subviews Both tabs have their Class attribute in the Identity Inspector set to UINavigationController. Now i have managed to get this far with my coding after VERY LONG trials. - (void)viewDidLoad { [super viewDidLoad]; myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate]; self.managedObjectContext = appDelegate.managedObjectContext; { NSError *error = nil; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity:[NSEntityDescription entityForName:@"User" inManagedObjectContext:self.managedObjectContext]]; NSArray *fetchedItems = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error]; NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"User" inManagedObjectContext:self.managedObjectContext]; // replace the old data with new. this DOESNT WORK if (fetchedItems.count > 0) { Usr *newUsr; for (newUsr in fetchedItems) { if ([newUsr.name isEqualToString:@"Line One"]) { newUsr.uName = @"Line One (new)"; } } } //add a new default data. THIS ADDS DATA TO MY TABLEVIEW BUT IT DOESNT SAVE THEM TO THE SQLITE User *addedDefaultdata = nil; addedDefaultdata = [[User alloc] initWithEntity:entityDesc insertIntoManagedObjectContext:self.managedObjectContext]; addedDefaultdata.name = @"Added new 1"; [addedDefaultdata release]; } NSError *error = nil; if (![[self fetchedResultsController] performFetch:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } } and my appdelegate looks like this: - (void)applicationDidFinishLaunching:(UIApplication *)application { [application setStatusBarStyle:UIStatusBarStyleBlackOpaque]; [window addSubview:navigationController.view]; [window makeKeyAndVisible]; } now I cannot quire the "User" at all! although i get no errors or warnings! Any suggestions would be much appreciated! Thanks

    Read the article

  • Frame sizing of tableview within nested child controllers/subviews

    - by jwoww
    I'm a bit confused by the proper frame sizing of a table view to fit within my screen. Here's my setup of view controllers within view controllers: UITabBarController UINavigationController as one of the tab bar viewcontrollers; title bar hidden ViewController - a container view controller because I need the option to place some controls beneath the UITableView, sometimes (but not in the current scenario) UITableViewController Now, my question is what the proper frame dimensions of the UITableview should be. Here's what I've got in the ViewController viewDidLoad method. I used subtracted 49.0 (the size of the tab bar) from 480.0. However, this leaves a black bar at the bottom. 20.0 appears to do it (coincidentally?) the size of the status bar, but I don't understand why that would be. Wouldn't the true pixel dimensions of the tableview be 480-49? // MessageTableViewController is my subclass of UITableViewController MessagesTableViewController *vcMessagesTable = [[MessagesTableViewController alloc] init]; CGRect tableViewFrame = CGRectMake(0, 0, 320.0, 480.0 - 49.0); [[vcMessagesTable view] setFrame:tableViewFrame]; self.tableViewController = vcMessagesTable; [self addChildViewController:vcMessagesTable]; [[self view] addSubview:vcMessagesTable.view]; Here's how it looks:

    Read the article

  • Admob in iPhone with Tabbar and TableView

    - by satyam
    I'm having tab bar with 5 buttons. Out of 5 tabs, 2 are table views which uses navigation controller for showing sub views on click of cell. Above the tab bar, in each view I left some space for ads using "Admob". I'm adding ads using IB. But its giving EXC_BAD_ACCESS when its reaching "adMobAd = [AdMobView requestAdWithDelegate:self];" in AdViewController.m I'm using following lines of code to add views to tab bar view. In my code, I just added ads to LatestNews only. Can some one help me out of this problem. UINavigationController *localNavigationController; // create tab bar controller and array to hold the view controllers tabBarController = [[UITabBarController alloc] init]; NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:5]; // setup the first view controller (Root view controller) LatestNews* latestNewsController; latestNewsController = [[LatestNews alloc] initWithTabBar]; // create the nav controller and add the root view controller as its first view localNavigationController = [[UINavigationController alloc] initWithRootViewController:latestNewsController]; // add the new nav controller (with the root view controller inside it) // to the array of controllers [localControllersArray addObject:localNavigationController]; // release since we are done with this for now [localNavigationController release]; [latestNewsController release]; // setup the second view controller just like the first Forums* forumsController; forumsController = [[Forums alloc] initWithTabBar]; localNavigationController = [[UINavigationController alloc] initWithRootViewController:forumsController]; [localControllersArray addObject:localNavigationController]; [localNavigationController release]; [forumsController release]; RecipeList* recipesController = [[RecipeList alloc] initWithTabBar]; localNavigationController = [[UINavigationController alloc] initWithRootViewController:recipesController]; [localControllersArray addObject:localNavigationController]; [localNavigationController release]; [recipesController release]; //Setup Connect view Connect* cnt = [[Connect alloc] initWithTabBar]; [localControllersArray addObject:cnt]; [cnt release]; //Setup Subscribe View Subscribe* scribe = [[Subscribe alloc] initWithTabBar]; [localControllersArray addObject:scribe]; [scribe release]; // load up our tab bar controller with the view controllers tabBarController.viewControllers = localControllersArray; [localControllersArray release]; [window addSubview:tabBarController.view]; [window makeKeyAndVisible];

    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

  • Two UIViews, one UIViewController (in one UINavigationController)

    - by jdandrea
    Given an iPhone app with a UITableViewController pushed onto a UINavigationController, I would like to add a right bar button item to toggle between the table view and an "alternate" view of the same data. Let's also say that this other view uses the same data but is not a UITableView. Now, I know variations on this question already exist on Stack Overflow. However, in this case, that alternate view would not be pushed onto the UINavigationController. It would be visually akin to flipping the current UIViewController's table view over and revealing the other view, then being able to flip back. In other words, it's intended to take up a single spot in the UINavigationController hierarchy. Moreover, whatever selection you ultimately make from within either view will push a common UIViewController onto the UINavigationController stack. Still more info: We don't want to use a separate UINavigationController just to handle this pair of views, and we don't want to split these apart via a UITabBarController either. Visually and contextually, the UX is meant to show two sides of the same coin. It's just that those two sides happen to involve their own View Controllers in normal practice. Now … it turns out I have already gone and quickly set this up to see how it might work! However, upon stepping back to examine it, I get the distinct impression that I went about it in a rather non-MVC way, which of course concerns me a bit. Here's what I did at a high level. Right now, I have a UIViewController (not a UITableViewController) that handles all commonalities between the two views, such as fetching the raw data. I also have two NIBs, one for each view, and two UIView objects to go along with them. (One of them is a UITableView, which is a kind of UIView.) I switch between the views using animation (easy enough). Also, in an effort to keep things encapsulated, the now-split-apart UITableView (not the UIViewController!) acts as its own delegate and data source, fetching data from the VC. The VC is set up as a weak, non-retained object in the table view. In parallel, the alternate view gets at the raw data from the VC in the exact same way. So, there are a few things that smell funny here. The weak linking from child to parent, while polite, seems like it might be wrong. Making a UITableView the table's data source and delegate also seems odd to me, thinking that a view controller is where you want to put that per Apple's MVC diagrams. As it stands now, it would appear as if the view knows about the model, which isn't good. Loading up both views in advance also seems odd, because lazy loading is no longer in effect. Losing the benefits of a UITableViewController (like auto-scrolling to cells with text fields) is also a bit frustrating, and I'd rather not reinvent the wheel to work around that as well. Given all of the above, and given we want that "flip effect" in the context of a single spot on a single UINavigationController, and given that both views are two sides of the same coin, is there a better, more obvious way to design this that I'm just happening to miss completely? Clues appreciated!

    Read the article

  • Calling popToRootViewControllerAnimated causing crash. How should I be doing this?

    - by Lewis42
    The app is for taking body measurements. The user can say I want to measure: legs, arms and neck, in the settings tab and in the main tab there is a view which loops round to take each measurement. This is achieved like so: i have tab controller the first tab has a navigation controller the first view controller on the storyboard and has one segue to itself the board loops round until it has all the measurements then it segues to a different controller the problem is: if the user changes which measurements they are taking in the settings tab, the first tab needs to completely reload, as if the app was just starting up, clearing down the whole nav stack etc. at the moment the tab controller calls popToRootViewControllerAnimated on the navigation controller in the measurements tab, but this is causing a crash. Each screen has a slider control and a call to titleForRow:forComponent: is being called on a deleted view causing it to crash. What am I doing wrong?! Here's the tab bar controller code // TabBarController.m // #import "TabBarController.h" #import "TodaysMeasurementObject.h" #import "AppDelegateProtocol.h" #import "AddMeasurementViewController.h" #import "ReadPerson.h" #import "AppDelegate.h" @interface TabBarController () <UITabBarControllerDelegate> @end @implementation TabBarController bool resetWizardView = false; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.delegate = self; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(measurementsSettingsUpdated:) name:@"MeasurementsSettingsUpdated" object:nil]; } - (void) measurementsSettingsUpdated:(NSNotification *) notification { // UINavigationController *navigationController = [self.viewControllers objectAtIndex:0]; // AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; // [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; resetWizardView = YES; } - (void) viewDidAppear:(BOOL)animated { if (![ReadPerson userHasRecords]) { [self setSelectedIndex:3]; } } - (void)orientationChanged:(NSNotification *)notification { // We must add a delay here, otherwise we'll swap in the new view // too quickly and we'll get an animation glitch [self performSelector:@selector(showGraphs) withObject:nil afterDelay:0]; } - (void)showGraphs { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (deviceOrientation == UIDeviceOrientationLandscapeLeft && !isShowingLandscapeView) { [self performSegueWithIdentifier: @"toGraph" sender: self]; isShowingLandscapeView = YES; } else if (deviceOrientation != UIDeviceOrientationLandscapeLeft && isShowingLandscapeView) { [self dismissModalViewControllerAnimated:YES]; isShowingLandscapeView = NO; } } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationLandscapeRight) { [self performSegueWithIdentifier: @"toGraph" sender: self]; } return false; } - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { int tbi = tabBarController.selectedIndex; if (tbi == 0) { [[viewController view] setNeedsDisplay]; if (resetWizardView) { [(UINavigationController*)[self.viewControllers objectAtIndex:0] popToRootViewControllerAnimated: NO]; // ******* POP CALLED HERE ****** resetWizardView = false; } } } - (TodaysMeasurementObject*) theAppDataObject { id<AppDelegateProtocol> theDelegate = (id<AppDelegateProtocol>) [UIApplication sharedApplication].delegate; TodaysMeasurementObject* theDataObject; theDataObject = (TodaysMeasurementObject*) theDelegate.theAppDataObject; return theDataObject; } - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } @end UPDATED - (void) measurementsSettingsUpdated:(NSNotification *) notification { NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray: self.viewControllers]; UINavigationController *navigationController = [viewControllers objectAtIndex:0]; AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; [viewControllers setObject:navigationController atIndexedSubscript:0]; self.viewControllers = viewControllers; } and removed the code from - tabBarController:didSelectViewController: but still the same error. I think the problem is that it's trying to get a value for the slide control after the view has been deleted. But some part of the view must still be alive...? Anyway to kill that off? Or leave it all alive??

    Read the article

< Previous Page | 6 7 8 9 10