UIWindow layout issue on ios7.1 with xcode 6.0 - xcode6

I created a project on xcode 6.0 and I've been running the project on ios8 simulator however when I tried run it on iphone5s ios7.1 simulator the UIWindow frame became to 320x480...
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
above is how I create UIwindow
What shall I do?

You must add correct size iphone/ipad default images, your problem will be solved. , see this link for further details Launch images screen size for iphone

Related

Orientation Issue with iOS 8

I have developed an iPad app for landscape orientation using freeform layout in one of
the ViewControllers.
It is working fine with iOS 7, but When I'm running the app using Xcode 6, the
controls in xib position varies.
I have Tried to modify auto layout check box, but no luck.
Can any one help me to solve this issue.
Thanks in advance
Add the following code in the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method:
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
[self.window setFrame:[[UIScreen mainScreen] bounds]];

Displaying a Custom UIView on Springboard (Jailbreak)

I created a custom UIView programmatically. Does anyone know what class and what method I would use to display this on the springboard? I want my UIView to display on the springboard, and when a user opens an app I want it to show up there too. I have been searching through the private headers for some time and I can't seem to find what I'm looking for. I am developing a jailbreak tweak with iosopendev. Also could you tell me if the class is a viewcontroller or just a view?
If you want the UIView to show anywhere (on SpringBoard and in apps), you should create a new UIWindow above the others and show your view in it like this :
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.windowLevel = UIWindowLevelAlert + 2;
[window setHidden:NO];
[window setAlpha:1.0];
[window setBackgroundColor:[UIColor clearColor]];
[window addSubview:yourView];
You can hook some methods of SpringBoard such as :
- (void)applicationDidFinishLaunching:(id)arg1
And then, your code should be like this :
- (void)applicationDidFinishLaunching:(id)arg1
{
%orig;
NSLog(#"----- applicationDidFinishLaunching -----");
UIWindow *_uiwindow = [[UIWindow alloc] initWithFrame:CGRectMake(100,100,120,100)];
_uiwindow.windowLevel = UIWindowLevelStatusBar;
_uiwindow.hidden = NO;
[_uiwindow setBackgroundColor:[UIColor redColor]];
}
To add more custom views,just add subview to _uiwindow. Hope that will help you.

Unable to detect iPhone Retina 4-inch screen size in simulator

I want to make my iOS application support iPhone 5. So I created a separate xib set for iPhone 5 size. Then I load each xib by checking the screen height.
This is the splash screen loading code inside the AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *viewController1;
if ([UIScreen mainScreen].bounds.size.height==480) {
viewController1 = [[SplashScreen alloc] initWithNibName:#"SplashScreen" bundle:nil];
}
if ([UIScreen mainScreen].bounds.size.height==568) {
viewController1 = [[SplashScreen alloc] initWithNibName:#"SplashScreen5" bundle:nil];
}
self.window.rootViewController = viewController1;
[self.window makeKeyAndVisible];
return YES;
}
But when I change the simulator into Retina 4-inch, my code doesn't get the emulator size. It always executes the 480 if condition.
But other apps I created like this are working properly.
What is the reason for this?
I'm having the exact same problem right now (at the worst moment, of course....).
It did work properly for several weeks, and for a unknown reason, the simulator suddenly considers the 4in simulated device as a 3.5in screen.
cleaning, reset, reboot : same situation...
EDIT : ok, problem solved. T'was because of a missing Default image in the -568#2x format. I knew that was a condition to make the system work, but xcode had apparently decided to get rid off the one I chose. oh well...

Black bar between navigation bar and table view appears on iOS 6

I seem to be having an issue since I started using iOS 6, which doesn't appear when using iOS 5. At first, I thought it might just be a simulator bug, but since testing it on my iPhone 5 today, I can see that it's not just in the simulator.
I'm creating everything programmatically — I seem to prefer doing it that way (I assume it's because of my HTML/CSS background!) — but I'm still reasonably new to Objective-C, and I couldn't find a full example of how to set up a navigation controller/table view programmatically, so I put it together from the nuggets of information I could find, and therefore, I could be doing something fundamentally wrong. However, it's worked (and still works) perfectly on iOS 5.
The problem is that I have a black bar between the navigation bar and the table view, but the strange thing is that if I push a view and go back to that original view, the bar disappears, and doesn't reappear until I completely restart the app.
The following image is of the app at launch (1), as I'm pushing a view in (2), and the initial view, after I've gone back to it (3):
This is what I have as my code:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *rootController = [[RootViewController alloc] init];
self.window.rootViewController = rootController;
self.navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
NSLog(#"Window frame: %#", NSStringFromCGRect(self.window.frame));
return YES;
}
RootViewController.m
- (void)loadView
{
self.title = #"Title";
self.tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.view = self.tableView;
NSLog(#"tableView frame: %#", NSStringFromCGRect(self.tableView.frame));
UIBarButtonItem *newViewButton = [[UIBarButtonItem alloc] initWithTitle:#"New View"
style:UIBarButtonItemStylePlain
target:self
action:#selector(newViewButtonTapped:)];
[self.navigationItem setRightBarButtonItem:newViewButton animated:NO];
}
I added the NSLogs to see if they showed anything that might help me. The output is:
tableView frame: {{0, 0}, {320, 480}}
Window frame: {{0, 0}, {320, 480}}
Can anyone give me any ideas about what I'm doing wrong? It seems is having a similar/the same problem (Black bar overtop navigation bar — in the comments), but I haven't found an answer.
Thanks, in advance!
You're adding the RootViewController to the window twice, once by setting UIWindow.rootViewController (which internally does [window addSubview:rootViewController.view]) and again by adding it as a subview of the navigation controller.
You should be doing this:
RootViewController *rootController = [[RootViewController alloc] init];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];
self.window.rootViewController = navigationController;
As a rule of thumb, never add a view directly to the window unless you know that you actually want to.

Splitview controller error in ios 4

I am new to iPhone development. I am working on a project having split view controllers. What I am doing is as follows
[self.splitViewController removeFromParentViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UINavigationController *detailViewNav=[[UINavigationController alloc]initWithRootViewController:SampleViewController];
self.nextSplitControler=[[UISplitViewController alloc]init];
self.nextSplitControler.viewControllers=[NSArray arrayWithObjects:masterNavigationController,detailViewNav, nil];
self.nextSplitControler.delegate=SampleViewController;
self.window.rootViewController=self.nextSplitControler;
[self.window makeKeyAndVisible];
It works fine on iOS 5.0 . But on iOS 4.3 it throws an error as
-[UISplitViewController removeFromParentViewController]: unrecognized selector sent to instance.
Can any one help me with this issue? I am banging my head.
Don't bang your head; check the docs. :)
- (void)removeFromParentViewController
Availability
Available in iOS 5.0 and later.