0

enter image description here

I am trying to figure out where set the window bounds. Currently view does not fill the entire screen.

I am just beginning to understand UI design for iOS. I have not set a rootViewController in the app delegate nor have i instantiated a navigation controller in which my view is embedded in.

I have tried using this the code below inside the didFinishLaunching method in appDelegate.

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
self.rootVC= [[LaunchViewController alloc] init];
self.window.rootViewController =  self.rootVC;

[self.window makeKeyAndVisible];
return YES;

Can someone help me understand why this is showing my view. IF i remove the added coded and just leave the return YES, my view loads but just as the picture i posted.

enter image description here

EDIT:

I need the label, and table view to extend across the entire screen and not just in the top left corner. I have no idea why it gets loaded like this and not across the entire screen.. Please help

3rdeye7
  • 536
  • 4
  • 25
  • Why are you replace `window` property in AppDelegate? Remove the first line and try again – Tj3n Jul 17 '17 at 04:22
  • @Tj3n I tried still loading a blank view. When i run my app on an ipad it doesnt fill the entire screen, other view controllers are full screen except my launch view – 3rdeye7 Jul 17 '17 at 04:31
  • Blank view is more likely because of your `[[LaunchViewController alloc] init];`, It init the viewcontroller without storyboard or xib or haven't implement `loadView` – Tj3n Jul 17 '17 at 04:33
  • @Tj3n I do not have a loadView, i have a viewdidload method. The problem is my view and my UI elements arent sized correctly on the first view (launchViewController). – 3rdeye7 Jul 17 '17 at 04:35
  • Are you trying to init view from Storyboard or Xib? – Tj3n Jul 17 '17 at 04:39
  • @Tj3n Storyboard, my LauchViewController is embedded in a navigation controller which is set as the initial view controller – 3rdeye7 Jul 17 '17 at 04:41
  • Why do you need your piece of code while you already set initial viewcontroller in your storyboard? Custom drawing? It will be automatically show without any code – Tj3n Jul 17 '17 at 04:48
  • @Tj3n The view is not loading to the correct size. When running on ipad you get the layout pictured above. It is only loading the view only on the top left corner and not across the full ipad screen. – 3rdeye7 Jul 17 '17 at 04:50
  • @Tj3n I am trying to just make sure it adjusts to the full size of the ipad screen on launch, right now i believe it might be referencing an iphone screen size? – 3rdeye7 Jul 17 '17 at 04:56
  • Dont need to, its automatically, unless you change the default setting in your storyboard/app settings/ or dont add necessary constraint – Tj3n Jul 17 '17 at 05:02
  • @Tj3n I dont think so, the view does not get loaded to correct size. Maybe I need to set the bounds or something for the LaunchViewController. I've read about the autoresizingmask but have no idea where and how to use it. – 3rdeye7 Jul 17 '17 at 05:17
  • did you check your constrains? – vp2698 Jul 17 '17 at 06:02
  • @vp2698 No, do you have any resources that would help-me set this accordingly for different devices? – 3rdeye7 Jul 17 '17 at 06:06
  • There are many way to set it You can refer Ray wenderlichs tutorial for it https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 – vp2698 Jul 17 '17 at 06:08
  • @vp2698 theres no way to just set views based on the device launching. I was hoping UI design would just reposition and set larger images with better resolution based on the device using something like UIWindow – 3rdeye7 Jul 17 '17 at 06:14
  • sorry but i am not getting what you main issue is – vp2698 Jul 17 '17 at 06:22
  • @vp2698 Take a look at my edit, ive been looking for hours now and no solution yet – 3rdeye7 Jul 17 '17 at 06:34

1 Answers1

2

this is not something about size of the window. this is about the size of the components you put into window.

if you are using storyboard, you have to give some constraints to your views.

you can check this link:

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraintsinInterfaceBuidler.html

cenk ebret
  • 687
  • 4
  • 15