uiviewcontroller

willRotateToInterfaceOrientation not being called

Hi, I'm returning YES in my view controller's shouldAutorotateToInterfaceOrientation function, and I can see using breakpoints that YES is being returned, however the willRotateToInterfaceOrientation method isn't being called, and nor is any other rotating method. It seems like after returning YES nothing happens! Any ideas? Mike ...

iPhone - Change target or selector for Back Button on UINavigationController

The default behaviour when pushing a UIViewController on a UINavigationController is for the OS to display a back button that pops the UIViewController off again. I have the desire to set a different behavior for this back button (to go back two screens) - is there anyway I can do this without having to create my own back button with cu...

UIView Controller doubt

Hi, I am creating a UIViewController using the nib file ? I have implemented the following 2 methods (void)viewDidAppear:(BOOL)animated (void)viewWillAppear:(BOOL)animated in my view controller, but these methods are not getting called every time ? What is the error in the code ? ...

Tab Bar within a navigation based aplication (Again)

Here is my problem: I've read a lot about how to use a tab bar within a navigation based application, but i still can't figure it out. I have tried both to use and avoid using a tab bar controller, but i just can't find the solution. I already have a navigation based app working. I have several nib files (views), each one with its own ...

present and dismiss modal view controller

Can anyone give me the example code that I can use to first present a modal view controller, then dismiss it? This is what I have been trying: NSLog(@"%@", blue.modalViewController); [blue presentModalViewController:red animated:YES]; NSLog(@"%@", blue.modalViewController); [blue dismissModalViewControllerAnimated:YES]; ...

Objective-C:UIScroller and UItextfields hidden by keyboard appearing in UIViewController

I need help trying to configure in a UIViewController, the keyboard : (a) not hovering over both UITextfields, so the scroller should be positioned correctly; and (b) When the user touches the background the keyboard disappears. I havent tried (b) yet but im trying (a) and the code I got from googling around didn't give me the desired e...

iPhone app: recover view after didReceiveMemoryWarning

The app in question has a MainView->ModalView pair. The ModalView is shown via UIModalTransitionStyleFlipHorizontal. In case of didReceiveMemoryWarning, MainView is dumped (since it is not visible) and the app stays "alive" but when you flip back there is a (very) short period of time when the screen is blank (since the modal dialog is r...

iPhone - Returning a value from a UIViewController which is presented using presentModalViewController

I have a very simple scenario: My iPhone application contains a UIViewController implementation which displays a list of items. In its navigation bar there is a button for adding items to that list. When this button is clicked, a new UIViewController is instantiated and presented on the screen using: [self presentModalViewController:co...

Pressing UINavigationController back button while typing.

I recently discovered that if a UITextField is being edited in a controller that's attached to a UINavigationController and the back button is pressed, upon returning to this controller, the DidBeginEditing function is called again and the UITextField keyboard is brought back up. I was wondering if there's a way to stop the keyboard from...

Views, subviews, root views, tabbarcontrollers, navbarcontrollers, woah! A diagram appraoch?

Sometimes just when I think got it, i get knocked back 2 steps. Like now add this block of code with a tabbarcontroller to this page, but with an edit button, and scrap that nav bar for a tabbar, but 1/2 is built in IB, the rest is built in code. yipes, sometimes it can get a bit nuts to make sense of it all. Has anyone found a nice ref...

IPhone View Controller Refactoring

I have a very complex game view with some custom views and some standard controls in the view. When some actions happen, i want to show a different view within the same area. What i have done is i have created two view objects in the view and incorporated the two views separately. As actions happen, i hide / unhide the views i need and i...

HOW TO: Layout images in a view that mimics the layout of application icons on the iPhone?

The iPhone shows applications icons, with the application name below ea. icon, on the screen 4 across and 4 down. What is the best way to replicate this type of view in a custom iPhone application? For example, I'd like to show a grid of players in a game I'm developing in a UIScrollView that shows a thumbnail of each player and their ...

initWithNibName always loads English xib

I have a localized AboutApp.xib file with English and es localized versions, but it always loads the English version even when I have the phone's language set to Spanish. How do I get it to load the Spanish version based on the language? // Make sure AboutApp View is allocated if (self.aboutAppController == nil) { AboutApp* aboutAp...

Replacing a UIViewController root view with my own view

I'm trying to replace a UIViewController root view with a subclassed UIView. In the iPhone SDK's UIViewController Class Reference, within it's Overview section, this is stated: You use each instance of UIViewController to manage a full-screen view. For a simple view controller, this entails managing the view hierarchy responsible fo...

How to load a View on a button press?

I am very new to iPhone Development so pardon me if this is a novice question. I have an app with a RootController that controls loading the various views. It initially loads a MenuView. The MenuView has a button that when a user clicks I want to open a whole different view (called InfoView) that displays some information about the ap...

UIViewController. viewDidLoad vs. viewWillAppear: What is the proper division of labor?

I have always been a bit unclear on the type of tasks that should be assigned to viewDidLoad vs. viewWillAppear: in a UIViewController subclass. For example, I am doing an app where I have a UIViewController subclass hitting a server, getting data, feeding it to a view and then displaying that view. What are the pros and cons of doing th...

Is it acceptable to place view logic in a strongly typed view-data class?

Say you've got a view which requires some piece of data which requires some calculation, but no outside dependances. (For example, an enumerable string listing of the past 5 years.) Is it acceptable to place this in a strongly typed view class? Something like this: class HomeIndexViewData { // ...some view data... public IEnumerable<...

iPhone: Rotating UIView - willRotateToInterfaceOrientation not being called (new post)

Hello everyone, I'm trying to autorotate a view and I have the same problem explained here: willRotateToInterfaceOrientation not being called. Even though I implemented shouldAutorotateToInterfaceOrientation and returned YES, in every UIViewController subclass I implemented; willRotateToInterfaceOrientation is not beign called. Perhap...

View Controller being sent a message even though it has been deallocated.

I am not sure if something has changed in the iPhone SDK 3.0 but I am getting the strangest error. I have a view controller hierarchy where I switch between view controllers depending upon interface orientation. From what I can tell, the error is caused whenever I rotate the interface a view controller which has been deallocated is being...

Call a function in a UIViewController's UIView

I've created a view controller and the associated view using the interface builder. I'm trying to call a function that I added to the UIView from the UIViewController. I'm not sure how to call that function though. I've tried [self.view myFunction] but that just makes my program crash. ...