开发者

view controller does not load with content

开发者 https://www.devze.com 2023-03-13 22:08 出处:网络
I have a button that when clicked shows a view controller. The code for that event is: and my view controller looks like this:

I have a button that when clicked shows a view controller. The code for that event is:

view controller does not load with content

and my view controller looks like this:

view controller does not load with content

note the segmented control and background image.

Here is my h and m files of my view controller in case you need them:

view controller does not load with content

when I run my app here is how that view control looks on my iPad:

view controller does not load with content

why do the background image and segmented control do not appear? why are contents not being loaded? It looks like another view controller is being loaded but I have already make sure that I am placing the correct name in the string for the view controller.


    - (IBAction) vaClick
{
    imgVa.image = [UIImage imageNamed:@"bt-valores.png"];

UIViewController *control = [[NuestrosValoresViewController alloc] initWithNibName:@"NuestrosValoresViewController"
                                                                            bundle:nil];
UINavigationController *navControl = [[UINavigationController alloc]
initWithRootViewController:control];
开发者_运维知识库
[self presentModalViewController:navControl animated:NO];

[navControl setNavigationBarHidden:YES];

[control release];
[navControl release];


//UINavigationController *navControl = [[UINavigationController alloc]
//initWithRootViewController:control];
//[self presentModalViewController:navControl animated:NO];

}

should I release it like this? sorry I basically have to translate a power point presentation to an app therefore I know very little about objective-c. thanks for the help and sorry for the dumb question.


You're not setting the root view controller of your UINavigationController.

Use this line instead when initializing the navigation controller:

UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController:control];

You'll also want to release navControl after you present it modally. I'll write out the code for you if you post your code instead of using screenshots.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号