u16suzuの blog

日々学んだことのメモブログです。

2013-07-01から1ヶ月間の記事一覧

UIEdgeInsets

UIEdgeInsets CSSにおける paddingみたいなもの. 元となる CGRect から paddingを適用した CGRect を生成することができる. UAModalPanelで使用されている. CGPointを考えなくてもいいところとサイズの計算を自分でしなくても良いところが便利. CGRect CGPoi…

UIScrollViewが持つ2つのサイズについて

Scroll Viewは2個のView Sizeを持っている. たまにその事実を忘れるというか,contentViewの存在を忘れるのでメモ. スクロールビューを窓と窓に表示される風景に例えて書くと... サイズその1. viewのSize: 窓のサイズ. scrollView.frameで指定する. サイズそ…

.pch ファイルで NSStringWithFormat を使う

.pch ファイルで NSStringWithFormat を使うことができる. URLを指定するときに便利 #define BASE_URL @"http://localhost:3000/" // 各機能での接続先URL #define URL_SETTINGS [NSString stringWithFormat:@"%@%@", BASE_URL, @"v1/settings.json"] #defin…

Mac で ファイルの md5 hashをとる

コマンドは以下のとおり $ openssl md5 file.txt

UINavigationBarに一括で画像をあてる

AppDelegate.mで以下のように書けば. アプリ内のすべてのナビゲーションバーに適用される. // Design UIImage *navigationBarImage = [UIImage imageNamed:@"topbar"]; [[UINavigationBar appearance] setBackgroundImage:navigationBarImage forBarMetrics:…

deep copy

deep copy するには copy methodを呼べばよい NSMutableArray *hoge = @[@1, @2, @3].mutableCopy; NSMutableArray *fuga = [[hoge copy] mutableCopy]; hoge[0] = @99; NSLog(@"hoge : %@", hoge); NSLog(@"fuga : %@", fuga); result 2013-07-04 03:26:25.…

UIAlertView

BlocksKit を使うとデリゲート書かなくて済む. 読みやすい. アラート出すだけなのにデリゲート書く必要があるのはやっぱり大げさだなぁ. UIAlertView *al = [UIAlertView alertViewWithTitle:@"OK?"]; [al addButtonWithTitle:@"OK" handler:^{ [self.naviga…

UITextAlignmentCenter series are Deprecated in iOS6

Use NSTextAlignmentCenter instead.

SubViewsをすべて消す

テーブルビューのセルでよく使います NSLog(@"before : %@", [cell.contentView subviews]); for (UIView *view in [cell.contentView subviews]) { [view removeFromSuperview]; } NSLog(@"after : %@", [cell.contentView subviews]);

AppDelegateをグローバルに使う

.pchファイル に書いておくと appをグローバルに使える #import <AppDelegate.h> // 共有オブジェクト #define app (AppDelegate *)[[UIApplication sharedApplication] delegate] #define SharedAppDelegate (AppDelegate *)[[UIApplication sharedApplication] delegate]</appdelegate.h>

UITabBarControllerの使い方

AppDelegate.m の中で, こんな感じで書けば良い self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; _tabBarController = [UITabBarController new]; _homeViewController = [HomeViewController new]; _postViewController =…