我想發展爲iPad迷你,但模擬器不附帶的Xcode 4.5。有什麼方法可以看到我的應用程序在新款iPad Mini上的樣子嗎?我正在使用Cordova框架。如何開發針對iPad迷你與科爾多瓦/ PhoneGap的?
0
A
回答
-1
轉到您的AppDelegate.m文件,並與這裏的代碼替換它:
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
//
// AppDelegate.m
// YOUR PROJECT NAME HERE
//
// Created by YOUR NAME HERE
// Copyright YOUR NAME HERE 2012. All rights reserved.
//
#import "AppDelegate.h"
#import "MainViewController.h"
#ifdef CORDOVA_FRAMEWORK
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVURLProtocol.h>
#else
#import "CDVPlugin.h"
#import "CDVURLProtocol.h"
#endif
@implementation AppDelegate
@synthesize window, viewController;
- (id) init
{
/** If you need to do any extra app-specific initialization, you can do it here
* -jm
**/
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
[CDVURLProtocol registerURLProtocol];
return [super init];
}
#pragma UIApplicationDelegate implementation
/**
* This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
*/
- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
NSString* invokeString = nil;
if (url && [url isKindOfClass:[NSURL class]]) {
invokeString = [url absoluteString];
NSLog(@"YOUR PROJECT NAME HERE launchOptions = %@", url);
}
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
self.window.autoresizesSubviews = YES;
CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
self.viewController = [[[MainViewController alloc] init] autorelease];
self.viewController.useSplashScreen = YES;
self.viewController.wwwFolderName = @"www";
self.viewController.startPage = @"index.html";
self.viewController.invokeString = invokeString;
self.viewController.view.frame = viewBounds;
// check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
BOOL forceStartupRotation = YES;
UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
if (UIDeviceOrientationUnknown == curDevOrientation) {
// UIDevice isn't firing orientation notifications yet… go look at the status bar
curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
}
if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
for (NSNumber *orient in self.viewController.supportedOrientations) {
if ([orient intValue] == curDevOrientation) {
forceStartupRotation = NO;
break;
}
}
}
if (forceStartupRotation) {
NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations);
// The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue];
NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
[[UIApplication sharedApplication] setStatusBarOrientation:newOrient];
}
[self.window addSubview:self.viewController.view];
[self.window makeKeyAndVisible];
CGFloat scale = 4.71f/5.82f;
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(scale, scale);
self.window.transform = CGAffineTransformConcat(scaleTransform, self.window.transform);
self.window.clipsToBounds = YES;
[self statusBarChanged:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(statusBarChanged:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
return YES;
}
- (void)statusBarChanged:(NSNotification *)note {
CGFloat scale = 4.71f/5.82f;
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(scale, scale);
UIWindow *statusBarWindow = (UIWindow *)[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
statusBarWindow.transform = CGAffineTransformConcat(scaleTransform, statusBarWindow.transform);
}
- (void)keyboardWillShow:(NSNotification *)note {
[self performSelector:(@selector(doMagicToKeyboard)) withObject:nil afterDelay:0];
}
-(void)doMagicToKeyboard {
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
[self checkForKeyboard:window];
}
}
- (void)checkForKeyboard:(UIView *)view {
static BOOL didIt = NO;
for (UIView *currentView in view.subviews) {
if(([[currentView description] hasPrefix:@"<UIKeyboard"] == YES) && !didIt)
{
didIt = YES;
UIView *thisView = currentView.superview.superview;
thisView.clipsToBounds = YES;
CGFloat scale = 4.71f/5.82f;
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(scale, scale);
thisView.transform = CGAffineTransformConcat(scaleTransform, thisView.transform);
} else {
[self checkForKeyboard:currentView];
}
}
}
// this happens while we are running (in the background, or from within our own app)
// only valid if Ipad Mini-Info.plist specifies a protocol to handle
- (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url
{
if (!url) {
return NO;
}
// calls into javascript global function 'handleOpenURL'
NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url];
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
// all plugins will get the notification, and their handlers will be called
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
return YES;
}
- (void) dealloc
{
[super dealloc];
}
@end
這將有助於誰想要開發爲iPad迷你的人;讓他們有機會看到他們的應用程序在新款iPad Mini上的樣子。如果沒有我在邁克爾斯萊特斯博客上閱讀的偉大文章,這是不可能的。以下是他爲我介紹Cordova應用程序的過程。謝謝邁克爾!
0
有一個模擬器 - 這就是所謂的iPad的模擬器。 iPad mini的分辨率與iPad相同。唯一的區別是像素密度 - 即iPad mini比iPad具有更大的像素密度。
相關問題
- 1. 的PhoneGap /科爾多瓦的Android開發
- 2. 開始與科爾多瓦
- 3. Phonegap /科爾多瓦與多個CDVViewController
- 4. 獲取與科爾多瓦/ PhoneGap的
- 5. 與科爾多瓦
- 6. 科爾多瓦/ Phonegap混淆
- 7. 如何UIUserInterfaceIdiomPad將針對iPad的迷你
- 8. Multipages與Phonegap /科爾多瓦2.2.0
- 9. 科爾多瓦/ Phonegap全球化與navigator.language
- 10. 的PhoneGap IOS PrintPlugin在PhoneGap的IOS(科爾多瓦2.0)2.0科爾多瓦
- 11. 如何讓GCM科爾多瓦得到與科爾多瓦2.3
- 12. 科爾多瓦(PhoneGap)科羅娜
- 13. 如何更新Phonegap項目創建科爾多瓦1.9到科爾多瓦3.1
- 14. 科爾多瓦,Node.js的,PhoneGap的
- 15. 的科爾多瓦/ PhoneGap的應用
- 16. 科爾多瓦:如何關閉科爾多瓦的頁面?
- 17. 在科爾多瓦
- 18. Instagram的iOS插件科爾多瓦/ Phonegap
- 19. PhoneGap的科爾多瓦2.0 onActivityResult不叫
- 20. 科爾多瓦/ PhoneGap的消息框
- 21. 「科爾多瓦/ CDVPlugin.h」文件中的PhoneGap
- 22. 的PhoneGap /科爾多瓦使用window.requestFileSystem()
- 23. 科爾多瓦/ PhoneGap的:安裝calendarPlugin
- 24. ORDER BY RANDOM()在科爾多瓦/ PhoneGap的
- 25. 的PhoneGap(或科爾多瓦)和requirejs
- 26. 科爾多瓦/ PhoneGap的GCM和Airpush
- 27. 科爾多瓦(PhoneGap的)網絡問題
- 28. 如何開始使用科爾多瓦
- 29. 科爾多瓦開始與jQuery
- 30. 對WebGL的科爾多瓦與three.js所
的OP使用科爾多瓦 - 即他們寫一個HTML5/JavaScript的應用程序 – ColinE
所以......?問題在於如何爲iPad Mini開發,而不是用什麼語言編寫應用程序。 – Mike