Search Results

Search found 825 results on 33 pages for 'uiviewcontroller'.

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

  • Make UIViewController outside Navigation Controller

    - by user1447316
    i have a question for you. I'm working on this app that has a walkthrough/tutorial screens and also login ones. On each of this screens there is a button to skip this part and go directly to use the app, without completing the registration (you know, so that people can test it before signing-in). As you can see i'm using Storyboards. The NowPlaying04 ViewController is actually the app itself. Obviously, when the user will be a registered one, i should also be able to jump right back to that screen, skipping the walkthrough and signin process. The first question is: how is the best way to structure this? The second quesion is: how i can make a ViewController outside that Navigation controller. Cause as you can see now, the NowPlaying04 ViewController inherits the top navigation bar. Which is a thing that i don't want. I don't need that. I hope that you have understood my question. I'll appreciate any help. Programmatically or by dragging stuff around, i'm ok with all the solutions. The important thing is that it works correctly! :-)

    Read the article

  • UIViewAnimation done by a UIViewController belonging to a UINavigationController?

    - by RickiG
    Hi I have an UINavigationController which the user navigates with. When pushing a specific UIViewController onto the navigation stack, a "settings" button appear in the navigationBar. When the user clicks this button I would like to flip the current view/controller, i.e. everything on screen, including the navigationBar, over to a settings view. So I have a SettingsViewController which I would like to flip to from my CurrentViewController that lives on a navigationController stack. I get all kinds of strange behavior trying to do this, the UIViews belonging to the SettingsViewController will start to animate, sliding into place, the navigationButtons moves around, nothing acts as I would think. -(void)settingsHandler { SettingViewController *settingsView = [[SettingViewController alloc] init]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:YES]; [self.navigationController.view addSubview:settingsView.view]; [UIView commitAnimations]; } The above results in the views flipping correctly, but the subviews of the SettingsViewController are all positioned in (0, 0) and after the transition, they 'snap' into place? Is it because I instantiate and add my subviews in viewDidLoad, like this? - (void)viewDidLoad { UIImageView *imageBg = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)]; [imageBg setImage:[UIImage imageNamed:@"background.png"]]; [self.view addSubview:imageBg]; [imageBg release]; SettingsSubview *switchView = [[SettingsSubview alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)]; [self.view addSubview:switchView]; [switchView release]; [super viewDidLoad]; } 1: How should I correctly do the "flip" transition, from within the UIViewController in the UINavigationController, to a new UIViewController and subsequently from the new UIViewController and back to the "original" UIViewController residing on the UINavigationControllers stack? 2: Should I use a different approach, than the "viewDidLoad" method, when instantiating and adding subviews to a UIViewController? -question 2 is more of a "best practice" thing. I have seen different ways of doing it and I am having trouble either finding or understanding the life-cycle documentation and the different threads and posts on the subject. I am missing the "best practice" examples. Thank You very much for any help given:)

    Read the article

  • How can I render an in-memory UIViewController's view Landscape?

    - by Aaron
    I'm trying to render an in-memory (but not in hierarchy, yet) UIViewController's view into an in-memory image buffer so I can do some interesting transition animations. However, when I render the UIViewController's view into that buffer, it is always rendering as though the controller is in Portrait orientation, no matter the orientation of the rest of the app. How do I clue this controller in? My code in RootViewController looks like this: MyUIViewController* controller = [[MyUIViewController alloc] init]; int width = self.view.frame.size.width; int height = self.view.frame.size.height; int bitmapBytesPerRow = width * 4; unsigned char *offscreenData = calloc(bitmapBytesPerRow * height, sizeof(unsigned char)); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef offscreenContext = CGBitmapContextCreate(offscreenData, width, height, 8, bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); CGContextTranslateCTM(offscreenContext, 0.0f, height); CGContextScaleCTM(offscreenContext, 1.0f, -1.0f); [(CALayer*)[controller.view layer] renderInContext:offscreenContext]; At that point, the offscreen memory buffers contents are portrait-oriented, even when the window is in landscape orientation. Ideas?

    Read the article

  • Why doesn't my UIViewController class keep track of an NSArray instance variable.

    - by TaoStoner
    Hey, I am new to Objective-C 2.0 and Xcode, so forgive me if I am missing something elementary here. Anyways, I am trying to make my own UIViewController class called GameView to display a new view. To work the game I need to keep track of an NSArray that I want to load from a plist file. I have made a method 'loadGame' which I want to load the correct NSArray into an instance variable. However it appears that after the method executes the instance variable loses track of the array. Its easier if I just show you the code.... @interface GameView : UIViewController { IBOutlet UIView *view IBOutlet UILabel *label; NSArray *currentGame; } -(IBOutlet)next; -(void)loadDefault; ... @implementation GameView - (IBOutlet)next{ int numElements = [currentGame count]; int r = rand() % numElements; NSString *myString = [currentGame objectAtIndex:(NSUInteger)r]; [label setText: myString]; } - (void)loadDefault { NSDictionary *games; NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"Games.plist"]; games = [NSDictionary dictionaryWithContentsOfFile:finalPath]; currentGame = [games objectForKey:@"Default"]; } when loadDefault gets called, everything runs perfectly, but when I try to use the currentGame NSArray later in the method call to next, currentGame appears to be nil. I am also aware of the memory management issues with this code. Any help would be appreciated with this problem.

    Read the article

  • How to link a UIViewController to a NIB file?

    - by jcdmb
    Hi everyone, I'm reading O'reilly's Learning iPhone Programming and on page 79 it says I have to create a new file (UIViewController subclass) and thick the checkbox to ask Xcode to generate an associated NIB file. The problem is: I do not have this option in my XCode 3.1 (this options is from XCode 3.2). So, I have to do it manually, and I don't know how. Could someone please help me? Thanks in advance!

    Read the article

  • How to implement UIViewController rotation in response to orientation changes?

    - by Greg Maletic
    My app has about 10 different UIViewControllers, just one of which I want to switch to landscape mode if the device is rotated. (All the rest, I want to keep in portrait.) In order to implement rotation on that one view, I needed to implement its controller's 'shouldAutorotate' method and return YES. Since this view is accessed via a navigation controller, I also needed to create a subclass of UINavigationController that implements 'shouldAutorotate' and return YES. This solution works, but too well. I find that all of the UIViewControllers I push onto my subclass of UINavigationController respond to rotation, even if I implement 'shouldAutorotate' and return NO. (Remember: I only want one particular UIViewController to respond to rotation, not every one in the navigation controller's stack.) So, my question is: how do I best do this? All the solutions I can come up with seem 1) cumbersome, and 2) worse, don't seem to work. Thanks very much.

    Read the article

  • Can I create a UITableViewController that inherits from a custom subclass of UIViewController?

    - by prendio2
    I have common functionality that I need to access from all screens of my app: a right bar button item and associated action. So as not to repeat the code I would like to set this up in a custom UIViewController and have all my view controllers inherit from it. - (void)viewDidLoad { UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(lightsCamera)]; self.navigationItem.rightBarButtonItem = rightBarButton; } - (void)lightsCamera { … } However, I have a number of UITableViewControllers however and I would like to know if it is possible for them to inherit the functionality too?

    Read the article

  • iPhone: should initWithNibName:bundle: method be deleted from UIViewController class if not used?

    - by Scott Pendleton
    I notice that this method is provided in UIViewController .m files, but is commented out: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil I had been leaving that method commented out, or even deleting it. But then I looked at this line inside the method: if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) I assume that if it were truly important for self to be set equal to super, then Apple would not have the method be commented out by default. On the other hand, if I do need to do some customization in that method, why do I need to set self = super? What's the best practice, and why?

    Read the article

  • How to use generic (NSObject) controller with subviews of a UIViewController?

    - by wanderlust
    I have a UIViewController that is loading several subviews at different times based on user interaction. I originally built all of these subviews in code, with no nib files. Now I am moving to nib files with custom UIView subclasses. Some of these subviews display static data, and I am using loadNibNamed:owner:options: to load them into the view controller. Others contain controls that I need to access. I (sort of) understand the reasons Apple says to use one view controller per screen of content, using generic controller objects (NSObjects) to manage subsections of a screen. So I need a view controller, a generic controller, a view class and a nib. How do I put this all together? My working assumptions and subsequent questions: I will associate the view class with the nib in the 'class identity' drop down in IB. The view controller will coordinate overall screen interactions. When necessary, it will create an instance of the generic controller. Does the generic controller load the nib? How? Do I define the outlets and actions in that view class, or should they be in the generic controller? How do I pass messages between the view controller and the generic controller? If anyone can point me to some sample code using a controller in this way, it will go a long way to helping me understand. None of the books or stackoverflow posts I've read have quite hit the spot yet.

    Read the article

  • How can I pass latitude and longitude values from UIViewController to MKMapView?

    - by jerincbus
    I have a detail view that includes three UIButtons, each of which pushes a different view on to the stack. One of the buttons is connected to a MKMapView. When that button is pushed I need to send the latitude and longitude variables from the detail view to the map view. I'm trying to add the string declaration in the IBAction: - (IBAction)goToMapView { MapViewController *mapController = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil]; mapController.mapAddress = self.address; mapController.mapTitle = self.Title; mapController.mapLat = self.lat; mapController.mapLng = self.lng; //Push the new view on the stack [[self navigationController] pushViewController:mapController animated:YES]; [mapController release]; //mapController = nil; } And on my MapViewController.h file I have: #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import "DetailViewController.h" #import "CourseAnnotation.h" @class CourseAnnotation; @interface MapViewController : UIViewController <MKMapViewDelegate> { IBOutlet MKMapView *mapView; NSString *mapAddress; NSString *mapTitle; NSNumber *mapLat; NSNumber *mapLng; } @property (nonatomic, retain) IBOutlet MKMapView *mapView; @property (nonatomic, retain) NSString *mapAddress; @property (nonatomic, retain) NSString *mapTitle; @property (nonatomic, retain) NSNumber *mapLat; @property (nonatomic, retain) NSNumber *mapLng; @end And on the pertinent parts of the MapViewController.m file I have: @synthesize mapView, mapAddress, mapTitle, mapLat, mapLng; - (void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; region.center.latitude = mapLat; //40.105085; region.center.longitude = mapLng; //-83.005237; region.span.longitudeDelta = 0.01f; region.span.latitudeDelta = 0.01f; [mapView setRegion:region animated:YES]; [mapView setDelegate:self]; CourseAnnotation *ann = [[CourseAnnotation alloc] init]; ann.title = mapTitle; ann.subtitle = mapAddress; ann.coordinate = region.center; [mapView addAnnotation:ann]; } But I get this when I try to build: 'error: incompatible types in assignment' for both lat and lng variables. So my questions are am I going about passing the variables from one view to another the right way? And does the MKMapView accept latitude and longitude as a string or a number?

    Read the article

  • How to implement a UINavigationController to a standard UIView

    - by tarnfeld
    This is the structure of my application currently: UIWindow UIViewController (Root View Controller) UINavigationController UITableView UIViewController (PresentModalViewControllerAnimated:YES) UITableView This is how I want it to be: UIWindow UIViewController (Root View Controller) UINavigationController UITableView UIViewController (PresentModalViewControllerAnimated:YES) UINavigationController UITableView I have a view that slides up and I want that view to have its own UINavigationController. It's for the app settings so I want to have nested options. Any ideas how to do this? The application type was a Navigation app to start with which is where the Root View Controller's UINavigationController came from.

    Read the article

  • UIViewController rotate methods

    - by Corey Floyd
    What object is responsible for dipatching the UIViewController rotation method calls, i.e: – shouldAutorotateToInterfaceOrientation: – willRotateToInterfaceOrientation:duration: – willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: – willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: – didRotateFromInterfaceOrientation: I imagine it is UIApplication (but maybe the AppDelegate or UIWindow). The next question, is how does the object know which UIViewController to talk to? How does it know which UIViewController has its view as the subview of the window? Is there a message you can send or a property you can set (of some object) that sets the "Active" UIViewController for the app?

    Read the article

  • UIViewController takes up entire screen in Interface Builder

    - by Sheehan Alam
    I have a NIB with a UIView that contains some UILabels, UIButtons etc. and a UIViewController that is loading a detached NIB. I want the UIViewController to be positioned below my UIView, but whenever I add it in Interface Builder it takes up the whole screen, and my UIView becomes part of the UIViewController. How can I make sure UIViewController appears below the UIView?

    Read the article

  • presentmodalviewcontroller not working properly in Application Delegate in iPhone

    - by sujyanarayan
    Hi, I'm using two UIViewController in Application Delegate and navigating to UIViewController using presentmodalviewcontroller. But Problem is that presentmodalviewcontroller works for first time UIViewController and when i want to navigate to second UIViewController using presentmodalviewcontroller then its showing first UIViewController. The following is the code:- -(void)removeTabBar:(NSString *)str { HelpViewController *hvc =[[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:[NSBundle mainBundle]]; VideoPlaylistViewController *vpvc =[[VideoPlaylistViewController alloc] initWithNibName:@"VideoPlaylistViewController" bundle:[NSBundle mainBundle]]; if ([str isEqualToString:@"Help"]) { [tabBarController.view removeFromSuperview]; [vpvc dismissModalViewControllerAnimated:YES]; [viewController presentModalViewController:hvc animated:YES]; [hvc release]; } if ([str isEqualToString:@"VideoPlaylist"]) { [hvc dismissModalViewControllerAnimated:YES]; [viewController presentModalViewController:vpvc animated:YES]; [vpvc release]; } } Can Somebody help me in solving the problem?

    Read the article

  • Orientation in UITabBarController + UIViewController

    - by Muhammad Hanifa S
    Anyone please answer for my requirement Im using my application in this order, first page = UIViewController, secondpage = UITabBarController with 4 tabs, I need landscape on the orientation on the second tabpage(UIViewController) ? not working.. Note : When using UITabBarController its working perfect but when I add the UIViewController for my first page, the orientation not working...? anyone who knows the solution plz answer

    Read the article

  • Init from nib, but alloc only [UIViewController]

    - by bobobobo
    So I'm doing this in my code now: UIViewController* ctrl = [[UIViewController alloc] // i'm alloc'ing a UIViewController... initWithNibName:@"TheNibName" // But this NIB has, within // interface builder, a link to "UIViewControllerDERIVATIVE". So really, // `ctrl` is a UIViewControllerDERIVATIVE instance, not just // a UIViewController instance. bundle:nil] ; The reason I'm doing this is it makes a massive convenience in writing some code that pushes modal dialogs on.. since Objective-C doesn't support <template>. My question is, is this ok?? Or will it bite me in the ass later?

    Read the article

  • How are people popping their UINavigationController stacks under a UITabBarController?

    - by RexOnRoids
    I have four UINavigationControllers assigned each to a tab in a UITabBarController. Each UINavigationController manages a UIViewController, which may itself branch out into other UIViewControllers below it hierarchally. My question is, in a case in which a user, under one tab, has navigated to a UIViewController that hierarchally BELOW the main UIViewController managed by the UINavigationController, and then the user pushes a different tab, and then goes back to the original tab, HOW can I make it so that the user is presented with the main UIViewController managed by the UINavigation controller? and not the page where he left off?

    Read the article

  • how to forward message from UITabBarController to another controller?

    - by RAGOpoR
    it cause from i insert UIViewController to subview of UITabBarController. once i want to set UIViewController shouldAutorotateToInterfaceOrientation and it not possible because it will call only in UITabBarController. how can i forward message from UITabBarController to call shouldAutorotateToInterfaceOrientation of each UIViewController instead of call UITabBarController only?

    Read the article

  • Adding a UINavigationController as a subview of UIView

    - by eagle
    I'm trying to display a UILabel on top of a UINavigationController. The problem is that when I add the UILabel as a subview of UIWindow it will not automatically rotate since it is not a subview of UIViewController (UIViewController automatically handles updating subviews during rotations). This is the hierarchy I was using: UIWindow UILabel UINavigationController So I was thinking I could use the following hierarchy: UIWindow UIViewController UIView UILabel UINavigationController This way the label could be displayed on top of the UINavigationController's bar while also automatically being rotated since it is a subview of UIViewController. The problem is that when I try adding a UINavigationController as a subview of a view: [myViewController.view addSubview:myNavigationController.view]; it will appear 20 pixels downwards. Which I'm guessing is because it thinks it needs to make room for the status bar. But, since the UINavigationController is being placed inside a UIView which does not overlay on top of the status bar, it is incorrectly adding an additional 20 pixels. In other words, the top of the UINavigationBar is at the screen's 40 pixel mark instead of at 20 pixels. Is there any easy way to just shift the UINavigationController and all of its elements (e.g. navigation bar, tool bar, root view controller) up 20 pixels? Or to let it know that it shouldn't compensate for a status bar? If not, I guess I would need to use my first hierarchy mentioned above and figure out how to rotate the label so it is consistent with the navigation bar's rotation. Where can I find more information on how to do this? Note: by "displaying a label on top of the navigation bar", I mean it should overlay on top of the navigation bar... it can't simply be wrapped in a bar button item and placed as one of the items of the navigation bar.

    Read the article

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