2011年4月23日土曜日

KeychainItemWrapper を改造して、複数の Keychain Item に同時にアクセス出来るようにしてみた

2011/04/23 Apple 


 iOS  Security.framework 使 Keychain  Security.framework C使 Apple  GenericKeychain  KeychainItemWrapper 使 Keychain 

 KeychainItemWrapper Version 1.2 KeychainItemWrapper 使25299

調
http://useyourloaf.com/blog/2010/3/29/simple-iphone-keychain-access.html
The combination of the final two attributes kSecAttrAccount and kSecAttrService should be set to something unique for this keychain. In this example I set the service name to a static string and reuse the identifier as the account name.
 KeychainItemWrapper  kSecAttrGeneric  Keychain 

 KeychainItemWrapper 
https://gist.github.com/938375

AppleAppleApple


 KeychainItemWrapper 使

 KeychainItemWrapper 
// インスタンスを作る
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.akisute.keychain.KeychainTestApp.item1"
serviceName:@"com.akisute.KeychainTestApp"
accessGroup:nil];

// 値を保存する
// いったんresetKeychainItemしているのはmyValueがnilのとき保存されているデータを削除したいから
// 基本的に値(kSecValueData)として保存できるのはUTF-8のNSStringのみです。内部的にNSDataに変換されてKeychainに保存されます。
// それ以外の情報を保存したい場合はすみませんが未対応です>< Base64文字列にするとかJSON文字列にするとか工夫して回避してください><
NSString *myValue = @"abesi";
[wrapper resetKeychainItem];
[wrapper setObject:myValue forKey:(id)kSecValueData];

// 値を取り出す
NSString *resultValue = [wrapper objectForKey:(id)kSecValueData];
NSLog(@"resultvalue = %@", resultValue);

iOS 3の UIScrollView はスクロールが発生しない状態では内部の UIView のタッチが取れない

iOS 3 iOS 4 UIScrollView 

iOS 3 UIScrollView  UIScrollView.bounds.size >= UIScrollView.contentSize  UIView  UIView  touchesBegan, touchesMoved, touchesEnded 
http://www.iphonedevsdk.com/forum/iphone-sdk-development/1345-uiscrollview-subview-touch-problem.html
Looks like as if the scrollview blocks any touches when the content rectangle is smaller or of same size as its bounds. Really strange behaviour. 
 Really strange behavior  Apple 

iOS 3 UIScrollView.contentSize 調 iOS 4


2011/05/02: @k_katsumi 
http://twitter.com/#!/k_katsumi/status/61690186664378368

 delaysContentTouches  canCancelContentTouches NO
scrollView.delaysContentTouches = NO;
scrollView.canCancelContentTouches = NO;

UIButton でアニメーションする画像を表示させたい

UIButton  UIButton.imageView.animationImages 使

 iOS 3.2  iOS 4.0 
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

NSArray *animationImageNames = [NSArray arrayWithObjects:@"animation1.png", @"animation2.png", @"animation3.png", nil];
NSMutableArray *animationImages = [NSMutableArray arrayWithCapacity:[animationImageNames count]];

for (NSString *animationImageName in animationImageNames) {
UIImage *image = [UIImage imageNamed:animationImageName];
[animationImages addObject:image];
}

[button setImage:[animationImages objectAtIndex:0] forState:UIControlStateNormal]; // 大事
button.imageView.animationImages = animationImages;
button.imageView.animationDuration = 2.0;
[button.imageView startAnimating]; // 大事、忘れるとアニメーションしません

[self.view addSubview:button];
UIButton.imageView.animatio
nImages 使
 setImage:forState: 使 UIButton.imageView 
iOS 4.0 UIButton  frame  iOS 3.2 

2011年4月17日日曜日

Xcode 4 で scheme が My Mac 64bit になって iPhone 向けのビルドが出来なくなった時の対処法


使 Xcode  Xcode 4   IDE 

 iOS  Xcode 4  scheme  My Mac 64bit  iPhone 


http://stackoverflow.com/questions/5319251/xcode-4-the-selected-run-destination-is-not-valid-for-this-action

Build Settings  Base SDK  Mac OS X SDK  iOS SDK 

Xcode 4.0  Xcode 4.0.1  Xcode 4.0.2 

Xcode 4 で build target 名にスペースが含まれているとビルド時に 100% エラーになる



タイトルからしてひどい出落ちですが、 Xcode 4 で build target 名にスペースが含まれているとビルドを行った際に 100% ビルドに失敗します。

原因がまたお粗末で、 Xcode 4 は build target 名をビルド成果物の中間配置ディレクトリの名前に使っているのですが、スペースをエスケープしていないためコンパイラが正しくパスを解釈できずに落ちているようです。がっくし。



Xcode 4.0 での調査結果です。 4.0.1 または 4.0.2 では修正されている可能性がありますが、いずれにせよスペースはさけたほうが良さそうです。

UINavigationController に管理されている UIViewController の view のサイズを変更したい

 UINavigationController  UIViewController  view 調


UINavigationController.view

iOS 4 


 UINavigationController.view  UILayoutContainerView  UINavigationTransitionView  UIViewControllerWrapperView  UIViewController.view 

 iOS 3.2  iOS 3.1.3 




 viewDidAppear  UIViewController.view.superview 
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.headerView.frame = CGRectMake(0, 0, 320, 100);
self.view.frame = CGRectMake(0, 100, 320, self.view.superview.frame.size.height - 100);
[self.view.superview addSubview:self.headerView];
}



 headerView  headerView  self.view.superview.bounds  UINavigationTransitionView  private  view 




 UIViewController  view