at kaneshin

Free space for me.



[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];


別にObjective-Cは関係ないけど、Objective-Cでやってます。 //* NSLog(@"foo"); /*/ NSLog(@"bar"); //*/ /* NSLog(@"foo"); /*/ NSLog(@"bar"); //*/ 1行目にスラッシュが1つか2つかだけです。 高度なコードすぎて、エディタによってはうまくシンタックス…

weak self の書き方

こんな感じでかいたりする __weak __typeof(&*self) self_ = self;


// single tap UITapGestureRecognizer* singleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTapGesture:)]; [self.view addGestureRecognizer:singleTapGesture]; // double tap UITapGestureRecognize…


NSDataの中身をみたくなったときは下記を埋め込む // NSData *data const unsigned char *ptr = [data bytes]; unsigned char s[512]; for(int i = 0, n = [data length]; i < n; ++i) { unsigned char c = *ptr++; s[i] = c; NSLog(@"char=%c hex=%x", c, c…


意図的にスレッドスリープさせたいとき [NSThread sleepForTimeInterval:.3f]; sleep()は整数のみ


そんなときは [button setEnabled:NO]; [button.titleLabel setAlpha:.5f]; で無理矢理白っぽくする!

Can I get a selected row of cell on Segue?

テーブルのセルの選択したものを知りつつ、セグエを使うとき - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:IDENTIFIER]) { // Assume self.view is the table view NSIndexPath *index…

How to get the font size and name on Xcode?

if you wanna get it. Simply code like this NSString *fontName = self.label.font.fontName; CGFloat fontSize = self.label.font.pointSize;




iOS6からはSocial.framework推奨になって、Twitter.frameworkはiOS5用となりましたね。で、うまい具合にiOS5, iOS6で使い分けてみた。kaneshin/Social-framework-objc · GitHubもっと楽ないい方法ないかね

iOS Device の OS version を取得

iOSをCompatible対応するときに必要かなと思った NSString *currentDeviceOSVersion = [[UIDevice currentDevice] systemVersion]; NSLog(@"%@", currentDeviceOSVersion); これで、NSString型でOSのVersionがわかるので、あとはif文とかで if ([currentDevi…

image scale

@interface UIImage (TPAdditions) - (UIImage*)imageScaledToSize:(CGSize)size; @end @implementation UIImage (TPAdditions) - (UIImage*)imageScaledToSize:(CGSize)size { UIGraphicsBeginImageContext(size); [self drawInRect:CGRectMake(0, 0, size.…

Back to Navigation Controller

Back to Previous View Controller with Navigation Controller.Use popViewControllerAnimated. // pop previous view controlller [self.navigationController popViewControllerAnimated:YES]; // pop root view controller [self.navigationController p…

push next Navigation Controller

Push next View Controller if you use.create new View Controller. then, use pushViewController:view FooViewController *foovc = [[FooViewController alloc] init]; [self.navigationController pushViewController:foovc animated:YES];

iPhone: Setting Navigation Bar Title

objective c - iPhone: Setting Navigation Bar Title - Stack OverflowIt's simply - (void)viewDidLoad { [super viewDidLoad]; self.title = @"title"; }