Push View Controller, Black Screen
I'm pushing to a new view controller and passing some data to it. When I run the application I can press the button and push to a new view but the screen is completely black. Any help is appreciated.
- (IBAction)button:(id)sender {
NSString *firstField = self.field.text;
NSString *secondField = self.field2.text;
self.resultsArray = [[NSArray alloc] initWithObjects:firstField, secondField, nil];
NSUInteger randomResult = arc4random_uniform(self.resultsArray.count);
self.label.text = [self.resultsArray objectAtIndex:randomResult];
ImagesViewController *ivc = [[ImagesViewController alloc] init];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
}
ios uiviewcontroller
add a comment |
I'm pushing to a new view controller and passing some data to it. When I run the application I can press the button and push to a new view but the screen is completely black. Any help is appreciated.
- (IBAction)button:(id)sender {
NSString *firstField = self.field.text;
NSString *secondField = self.field2.text;
self.resultsArray = [[NSArray alloc] initWithObjects:firstField, secondField, nil];
NSUInteger randomResult = arc4random_uniform(self.resultsArray.count);
self.label.text = [self.resultsArray objectAtIndex:randomResult];
ImagesViewController *ivc = [[ImagesViewController alloc] init];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
}
ios uiviewcontroller
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21
add a comment |
I'm pushing to a new view controller and passing some data to it. When I run the application I can press the button and push to a new view but the screen is completely black. Any help is appreciated.
- (IBAction)button:(id)sender {
NSString *firstField = self.field.text;
NSString *secondField = self.field2.text;
self.resultsArray = [[NSArray alloc] initWithObjects:firstField, secondField, nil];
NSUInteger randomResult = arc4random_uniform(self.resultsArray.count);
self.label.text = [self.resultsArray objectAtIndex:randomResult];
ImagesViewController *ivc = [[ImagesViewController alloc] init];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
}
ios uiviewcontroller
I'm pushing to a new view controller and passing some data to it. When I run the application I can press the button and push to a new view but the screen is completely black. Any help is appreciated.
- (IBAction)button:(id)sender {
NSString *firstField = self.field.text;
NSString *secondField = self.field2.text;
self.resultsArray = [[NSArray alloc] initWithObjects:firstField, secondField, nil];
NSUInteger randomResult = arc4random_uniform(self.resultsArray.count);
self.label.text = [self.resultsArray objectAtIndex:randomResult];
ImagesViewController *ivc = [[ImagesViewController alloc] init];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
}
ios uiviewcontroller
ios uiviewcontroller
edited Jul 25 '13 at 15:41
9to5ios
3,16522153
3,16522153
asked Jul 25 '13 at 15:12
Brandon HoulihanBrandon Houlihan
104116
104116
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21
add a comment |
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21
add a comment |
7 Answers
7
active
oldest
votes
When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:
ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
The storyboard object can be retrieved with[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").
– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
|
show 2 more comments
The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
if you have a xib assign it like
ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName:<your xib> bundle:[NSBundle mainbundle];
if you are using custom view, assign a frame dimension and add it as subview
add a comment |
Xcode 7.3 and Swift 2.2
In my case, I had made changes in the storyboard and made it a TabBarController and accordingly changed the class of the controller from UIViewController to UITabBarController. After some tweaking, this change wasn't favourable and I un did all the changes and got a black screen then because I had forgotten to change the class of the controller. I changed it back to UIViewController and it started working again.
So check if you have made the same mistake. The black screen came because the storyboard had a class(UIView/UITabBar/UITableView Controller) but that wasnt the same in code.
add a comment |
This can also happen if you have somehow got an incorrect connection between one of the subviews in the storyboard to the controller's view. Check the Referencing Outlets are correct in each of your subviews.
add a comment |
I got a good one:
Make sure you are implementing the right Super class, delegate, etc.. in the top part of the viewController you are trying to present. i.e.
I wasn't using/implementing UINavigationController at all
class TMDetailBlogViewController: UINavigationController {
//code goes here
}
After
class TMDetailBlogViewController: UIViewController {
//code goes here
}
add a comment |
Typically, you transition to another view controller by calling:
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
on your custom UIViewController.
If you're not using a xib file, then what you're doing may be fine. Are you dynamically creating your UI elements within the constructor of your ImagesViewController?
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
add a comment |
I was trying without using storyboard, and its just that the default screen it uses is in black color. I changed the background color to white and it worked.
Pushed the controller this way-
NextController *nextController = [[NextController alloc]init];
[self.navigationController pushViewController:nextController animated:YES];
In NextController-
(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
}
add a comment |
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17861940%2fpush-view-controller-black-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:
ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
The storyboard object can be retrieved with[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").
– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
|
show 2 more comments
When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:
ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
The storyboard object can be retrieved with[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").
– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
|
show 2 more comments
When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:
ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:
ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
ivc.label = self.label.text;
[self.navigationController pushViewController:ivc animated:YES];
edited Mar 27 '14 at 15:04
answered Jul 25 '13 at 16:19


rdelmarrdelmar
98.8k10191209
98.8k10191209
The storyboard object can be retrieved with[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").
– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
|
show 2 more comments
The storyboard object can be retrieved with[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").
– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
The storyboard object can be retrieved with
[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").– Brian White
Feb 7 '14 at 21:36
The storyboard object can be retrieved with
[UIStoryboard storyboardWithName:@"Main" bundle: nil];
where "Main" is the storyboard's filename without the extension (so could also be "Main_iPhone" or "Main_iPad").– Brian White
Feb 7 '14 at 21:36
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
@BrianWhite, true, but if the calling controller is in the same storyboard as the new controller, it's shorter to just use self.storyboard.
– rdelmar
Feb 7 '14 at 22:37
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Sure. I was trying to access it from the AppDelegate which did not have that property and so had to do some more searching. I figured I'd append what I learned so others might avoid the extra work if they were trying to do the same.
– Brian White
Feb 8 '14 at 1:52
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
Anyone that tried this and had the "Expected ']'" warning, put a ':'before "@MyIdentifier", so it will stay like this: instantiateViewControllerWithIdentifier:@"MyIdentifier"
– Rodrigo Venancio
Mar 27 '14 at 14:57
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
@RodrigoVenancio, thanks for catching that typo. I've corrected the post.
– rdelmar
Mar 27 '14 at 15:04
|
show 2 more comments
The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
if you have a xib assign it like
ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName:<your xib> bundle:[NSBundle mainbundle];
if you are using custom view, assign a frame dimension and add it as subview
add a comment |
The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
if you have a xib assign it like
ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName:<your xib> bundle:[NSBundle mainbundle];
if you are using custom view, assign a frame dimension and add it as subview
add a comment |
The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
if you have a xib assign it like
ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName:<your xib> bundle:[NSBundle mainbundle];
if you are using custom view, assign a frame dimension and add it as subview
The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
if you have a xib assign it like
ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName:<your xib> bundle:[NSBundle mainbundle];
if you are using custom view, assign a frame dimension and add it as subview
answered Jul 25 '13 at 15:29
slysidslysid
1,87832244
1,87832244
add a comment |
add a comment |
Xcode 7.3 and Swift 2.2
In my case, I had made changes in the storyboard and made it a TabBarController and accordingly changed the class of the controller from UIViewController to UITabBarController. After some tweaking, this change wasn't favourable and I un did all the changes and got a black screen then because I had forgotten to change the class of the controller. I changed it back to UIViewController and it started working again.
So check if you have made the same mistake. The black screen came because the storyboard had a class(UIView/UITabBar/UITableView Controller) but that wasnt the same in code.
add a comment |
Xcode 7.3 and Swift 2.2
In my case, I had made changes in the storyboard and made it a TabBarController and accordingly changed the class of the controller from UIViewController to UITabBarController. After some tweaking, this change wasn't favourable and I un did all the changes and got a black screen then because I had forgotten to change the class of the controller. I changed it back to UIViewController and it started working again.
So check if you have made the same mistake. The black screen came because the storyboard had a class(UIView/UITabBar/UITableView Controller) but that wasnt the same in code.
add a comment |
Xcode 7.3 and Swift 2.2
In my case, I had made changes in the storyboard and made it a TabBarController and accordingly changed the class of the controller from UIViewController to UITabBarController. After some tweaking, this change wasn't favourable and I un did all the changes and got a black screen then because I had forgotten to change the class of the controller. I changed it back to UIViewController and it started working again.
So check if you have made the same mistake. The black screen came because the storyboard had a class(UIView/UITabBar/UITableView Controller) but that wasnt the same in code.
Xcode 7.3 and Swift 2.2
In my case, I had made changes in the storyboard and made it a TabBarController and accordingly changed the class of the controller from UIViewController to UITabBarController. After some tweaking, this change wasn't favourable and I un did all the changes and got a black screen then because I had forgotten to change the class of the controller. I changed it back to UIViewController and it started working again.
So check if you have made the same mistake. The black screen came because the storyboard had a class(UIView/UITabBar/UITableView Controller) but that wasnt the same in code.
answered Jun 2 '16 at 6:16
Yash TamakuwalaYash Tamakuwala
6141116
6141116
add a comment |
add a comment |
This can also happen if you have somehow got an incorrect connection between one of the subviews in the storyboard to the controller's view. Check the Referencing Outlets are correct in each of your subviews.
add a comment |
This can also happen if you have somehow got an incorrect connection between one of the subviews in the storyboard to the controller's view. Check the Referencing Outlets are correct in each of your subviews.
add a comment |
This can also happen if you have somehow got an incorrect connection between one of the subviews in the storyboard to the controller's view. Check the Referencing Outlets are correct in each of your subviews.
This can also happen if you have somehow got an incorrect connection between one of the subviews in the storyboard to the controller's view. Check the Referencing Outlets are correct in each of your subviews.
answered Feb 25 '15 at 9:03


sdsykessdsykes
1,1961113
1,1961113
add a comment |
add a comment |
I got a good one:
Make sure you are implementing the right Super class, delegate, etc.. in the top part of the viewController you are trying to present. i.e.
I wasn't using/implementing UINavigationController at all
class TMDetailBlogViewController: UINavigationController {
//code goes here
}
After
class TMDetailBlogViewController: UIViewController {
//code goes here
}
add a comment |
I got a good one:
Make sure you are implementing the right Super class, delegate, etc.. in the top part of the viewController you are trying to present. i.e.
I wasn't using/implementing UINavigationController at all
class TMDetailBlogViewController: UINavigationController {
//code goes here
}
After
class TMDetailBlogViewController: UIViewController {
//code goes here
}
add a comment |
I got a good one:
Make sure you are implementing the right Super class, delegate, etc.. in the top part of the viewController you are trying to present. i.e.
I wasn't using/implementing UINavigationController at all
class TMDetailBlogViewController: UINavigationController {
//code goes here
}
After
class TMDetailBlogViewController: UIViewController {
//code goes here
}
I got a good one:
Make sure you are implementing the right Super class, delegate, etc.. in the top part of the viewController you are trying to present. i.e.
I wasn't using/implementing UINavigationController at all
class TMDetailBlogViewController: UINavigationController {
//code goes here
}
After
class TMDetailBlogViewController: UIViewController {
//code goes here
}
answered Oct 21 '16 at 20:54


idelfonsogutierrezidelfonsogutierrez
424
424
add a comment |
add a comment |
Typically, you transition to another view controller by calling:
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
on your custom UIViewController.
If you're not using a xib file, then what you're doing may be fine. Are you dynamically creating your UI elements within the constructor of your ImagesViewController?
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
add a comment |
Typically, you transition to another view controller by calling:
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
on your custom UIViewController.
If you're not using a xib file, then what you're doing may be fine. Are you dynamically creating your UI elements within the constructor of your ImagesViewController?
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
add a comment |
Typically, you transition to another view controller by calling:
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
on your custom UIViewController.
If you're not using a xib file, then what you're doing may be fine. Are you dynamically creating your UI elements within the constructor of your ImagesViewController?
Typically, you transition to another view controller by calling:
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
on your custom UIViewController.
If you're not using a xib file, then what you're doing may be fine. Are you dynamically creating your UI elements within the constructor of your ImagesViewController?
answered Jul 25 '13 at 15:18
Paul DardeauPaul Dardeau
2,121189
2,121189
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
add a comment |
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
I don't have a xib. I'm creating the UI elements from the storyboard.
– Brandon Houlihan
Jul 25 '13 at 15:50
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
In that case, you probably want to make use of this method to handle your view transition: - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
– Paul Dardeau
Jul 25 '13 at 15:53
add a comment |
I was trying without using storyboard, and its just that the default screen it uses is in black color. I changed the background color to white and it worked.
Pushed the controller this way-
NextController *nextController = [[NextController alloc]init];
[self.navigationController pushViewController:nextController animated:YES];
In NextController-
(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
}
add a comment |
I was trying without using storyboard, and its just that the default screen it uses is in black color. I changed the background color to white and it worked.
Pushed the controller this way-
NextController *nextController = [[NextController alloc]init];
[self.navigationController pushViewController:nextController animated:YES];
In NextController-
(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
}
add a comment |
I was trying without using storyboard, and its just that the default screen it uses is in black color. I changed the background color to white and it worked.
Pushed the controller this way-
NextController *nextController = [[NextController alloc]init];
[self.navigationController pushViewController:nextController animated:YES];
In NextController-
(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
}
I was trying without using storyboard, and its just that the default screen it uses is in black color. I changed the background color to white and it worked.
Pushed the controller this way-
NextController *nextController = [[NextController alloc]init];
[self.navigationController pushViewController:nextController animated:YES];
In NextController-
(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
}
answered Jan 2 at 20:01
Sneha Priya AleSneha Priya Ale
113
113
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17861940%2fpush-view-controller-black-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what is the context of this ? are you allocating the view controller from storyboard? a xib file? no thing at all just randomly?
– A'sa Dickens
Jul 25 '13 at 15:21