Skip to content

Instantly share code, notes, and snippets.

View tatsuro-ueda's full-sized avatar

Tatsuro Ueda tatsuro-ueda

View GitHub Profile
@tatsuro-ueda
tatsuro-ueda / Press-and-hold-to-make-Image-move
Created August 11, 2012 11:03
【performSelector】ボタンを押し続けるとイメージが動き、離すと動きが止まる、には
##Press and hold to make Image move
With below code, you have to push 3 seconds to move _imageView, and then the image begins moving, and when you release the button, the image stops.
![ss](http://farm8.staticflickr.com/7264/7758110866_f2d3a47f04_o.png)
- (IBAction)pushToMove:(id)sender {
[self performSelector:@selector(move) withObject:nil afterDelay:3.0];
}
@tatsuro-ueda
tatsuro-ueda / Speed-of-segue-between-ViewControllers.md
Created August 11, 2012 10:44
【セグエ】セグエによる遷移のスピードを変えるには

##Speed of segue between ViewControllers

Below code is of custom segue, and you can set duration of transition in code.

- (void)perform 
{
    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;
    [UIView transitionFromView:src.view

toView:dst.view

##How to write text with angle on picture in objective c

Below code rotates the label

- (IBAction)rotate:(id)sender {
    CGContextRef context = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:context];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector(endAnimation)];

@tatsuro-ueda
tatsuro-ueda / Change-the-position-of-UIBarButtonItem.md
Created August 11, 2012 10:41
【IB】ナビゲーションバー上のUIBarButtonItemの位置を変えるには

##Change the position of UIBarButtonItem

I think present location setting is lick below:

ss

Under this setting the length of left margin is adopted to landscape mode. So you have to set the length of right margin and let the botton put right end of navigation bar.

You would better set the setting as below:

@tatsuro-ueda
tatsuro-ueda / YouTube-Video-Api-in-JSON-Format.md
Created August 11, 2012 10:40
【テーブル】【JSON】【AFNetworking】YouTube APIで得たJSONを使ってテーブルを作るには

##YouTube Video Api in JSON Format

Below code parse YouTube JSON to table view.

ss

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;

if (indexPath.row < [[_JSON valueForKeyPath:@"data.items.title"] count]) {

@tatsuro-ueda
tatsuro-ueda / Text-views-on-table-view-cells.md
Created August 11, 2012 10:38
【IB】UITextViewをUITableViewに載せるには

You can make it with TextView like below:

ss

ss

You can make this by only IB like below:

ss

@tatsuro-ueda
tatsuro-ueda / スレッドの使い方メモ.m
Created August 10, 2012 15:54
スレッドの使い方メモ
/*
* 別スレッドを立てる
*/
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[queue addOperationWithBlock:^{
// 何かする
}];
@tatsuro-ueda
tatsuro-ueda / You-dont-have-to-edit-storyboard-to-update-old-one-to-new-one-manually.md
Created August 10, 2012 15:14
You don't have to edit storyboard to update old one to new one manually

You don't have to edit storyboard to update old one to new one manually

At first, you should sub click on newer storyboad in navigation view.

ss

Then you see menus and...

ss

@tatsuro-ueda
tatsuro-ueda / ストーリーボードの日本語と英語のものと2つできてしまって変更するたびにもう片方を消してコピーしなくて済む方法.md
Created August 10, 2012 14:59
ストーリーボードの日本語と英語のものと2つできてしまって変更するたびにもう片方を消してコピーしなくて済む方法

まず新しい方のストーリーボードをナビゲーションビュー上で右クリック。

ss

出てきたメニューから・・・

ss

[Open As] -> [Source Code]

@tatsuro-ueda
tatsuro-ueda / Objective-Cのハマりどころ.md
Created August 9, 2012 02:22
Objective-Cのハマりどころ
  • delegateの指定忘れ
  • 要素数を求めるのにsizeof(Array)/sizeof(Array[0])と割るのを忘れている
  • プロパティのプロパティにperformSegueで値を代入しようとして入らない
  • 配列の初期化忘れ array = [NSArray array];
  • [NSString stringWithFormat:@"%@", count]; 正しくは%d
  • TableViewCellのIdentifierの指定忘れ
  • ViewControllerのつなぎ忘れ
  • アプリ名-Prefix.pchの名前変更忘れ→だめ
  • 通知センターは4つ同じ名前を設定する
  • Push Notificationがうまくいかないときはプロジェクトを新規に作り、ファイルを移す