2013年3月15日金曜日

[iOS]iOSシミュレーターの格納場所

フォルダパスは
/Users/[User Name]/Library/Application Support/iPhone Simulator/6.1
または
/Library/Application Support/iPhone Simulator/6.1
iOSのバージョンごとにフォルダ分けされている。

Applicationsフォルダ内の
HOGE1234-HO77-HO77-HO77-HOGE123456789
などのフォルダがアプリ格納の場所。

ファイルのアウトプットはDocuments内に格納される。

2013年3月8日金曜日

[iOS]Enumeration values * not handled in switch


Enumeration values * not handled in switch

列挙子*はswitchで処理されていません。
つまりswitchで列挙子をすべて網羅する必要がある。

2013年3月4日月曜日

[iOS]iOS4.3~5.1~6.1に回転対応をする

あらかじめ[appname].plistSupported interface orientationsを設定する必要がある。

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //iOS 4.3~5.1 回転時の呼び出しメソッドを設定
    
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(orientationChanged:)
                                                 name:UIDeviceOrientationDidChangeNotification
                                               object:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    //iOS 4.3~5.1 回転の停止
    //他のViewControllerで使用したくないときはここでキャンセルする
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:UIDeviceOrientationDidChangeNotification
                                                  object:nil];
}

//iOS 6.0~ 回転をサポートするか
- (BOOL)shouldAutorotate
{
    return YES;
}

//iOS 6.0~ 推奨される向き
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

//iOS 6.0~ サポートする向き
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

//iOS 4.3~5.1 回転をサポートするか?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

//回転時の動作
- (void)orientationChanged:(NSNotification *)notification
{

}

//回転時のアニメーションを定義
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{

}

//回転前に呼び出される
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

}