Skip to content

Instantly share code, notes, and snippets.

View himaratsu's full-sized avatar

himaratsu himaratsu

  • Indivisual
  • Tokyo, Japan
View GitHub Profile
@himaratsu
himaratsu / swift_cast.md
Created October 14, 2014 02:47
swift_cast

CGFloat convert int みたいなエラーが出るとき

stampNineView.frame = CGRectMake(self.frame.size.width * CGFloat(i), 0, self.frame.size.width, self.frame.size.width)

Swiftは型に厳しいので、 self.frame.size.width * i とかしてたら怒られる。
Objective-C時代は暗黙的にキャストしてくれてたので。

@himaratsu
himaratsu / command_line_usage.md
Created October 12, 2014 07:20
iOS.zip command line tool

iOS.zip command line tool

Install

$ curl -O https://raw.githubusercontent.com/ioszip/ioszip.github.io/command-line-tool/ioszip.github.io.rb >  /usr/local/Library/Formula/ioszip.github.io.rb; brew install ioszip.github.io

Usage

@himaratsu
himaratsu / push_test_tips.md
Created October 6, 2014 02:40
Pushのテスト
Resetting the Push Notifications Permissions Alert on iOS
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:

Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.
@himaratsu
himaratsu / IBInspectable.md
Last active August 29, 2015 14:06
アイビーインスペクタビリティ

Embeded Frameworkに入れる必要もない

  • 昔はあったっぽい

IBDesignableで編集が容易なクラスを作成

@IBDesignable
class CardView: UIView {
@himaratsu
himaratsu / html5_start
Created August 2, 2014 13:27
HTML5テンプレ
```
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<h1>Hello!</h1>
@himaratsu
himaratsu / xcode_color.md
Last active August 29, 2015 14:04
Xcodeで色を操る
@himaratsu
himaratsu / localize_app.md
Created August 1, 2014 01:08
アプリをLocalizeする

Xcodeをローカライズ

  • Xcode -> Project -> Localize

Storyboardをローカライズ

  • Japanese (Strings)をつくる
  • (Storyboard_id).text = とかなってる
  • ここを書き換えていく
  • 変更に追従してくれないので、シェルスクリプトを設定すると良い
@himaratsu
himaratsu / addOverlay.md
Created July 31, 2014 05:26
UINavigationの上からviewを貼る
#import "ATDAppDelegate.h"

ATDAppDelegate *appDelegate = (ATDAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:self];
@himaratsu
himaratsu / ns_enum.md
Last active August 29, 2015 14:04
NS_ENUMを使って設定画面のtableviewをつくる

セルの種類をNS_ENUMで宣言する

typedef NS_ENUM(NSUInteger, PKSSettingCellType) {
    PKSSettingCellTypeHowToUse,     // 使い方
    PKSSettingCellTypeLicense,      // ライセンス
    PKSSettingCellTypeRequest,      // ご意見
    PKSSettingCellTypeVersion       // アプリバージョン
};
@himaratsu
himaratsu / customNib.md
Created July 18, 2014 06:04
カスタムViewをnibから読みこんで受け取る
+ (instancetype)view {
    NSString *className = NSStringFromClass([self class]);
    return [[[NSBundle mainBundle] loadNibNamed:className owner:nil options:0] firstObject];
}