This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const int ModalWindowId = 100; | |
private Rect windowRect; | |
void OnGUI() | |
{ | |
windowRect = GUI.ModalWindow( | |
ModalWindowId, | |
new Rect(0, 0, Screen.width, Screen.height), | |
ModalWindowCallback, | |
"モーダルだよー!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// フレームワークを2つインポート | |
// <AssetsLibrary/AssetsLibrary.h> -> AssetLibrary.framework | |
// <AVFoundation/AVFoundation.h> -> AVFoundation.framework | |
+ (NSArray *)sliceMovie:(NSURL *)url | |
{ | |
AVURLAsset* asset = [[AVURLAsset alloc] initWithURL:url options:nil]; | |
if ( ! [asset tracksWithMediaCharacteristic:AVMediaTypeVideo]) { | |
NSLog(@"MovieUtil : ビデオタイプのファイルを指定して下さい [%@]", url); | |
return nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// フレームワークを2つインポート | |
// #import <ImageIO/ImageIO.h> -> ImageIO.framework | |
// #import <MobileCoreServices/MobileCoreServices.h> -> MobileCoreService.framework | |
+ (NSData *) generateGifDataWithImages:(NSArray *)images | |
{ | |
// 何秒間隔で画像を切り替えるか | |
NSDictionary *frameProperties = | |
@{ (NSString *)kCGImagePropertyGIFDictionary: @{ (NSString *)kCGImagePropertyGIFDelayTime : @(1) } }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #import <Social/Social.h> -> Social.framework | |
// #import <Accounts/Accounts.h> -> Accounts.framework | |
// 投稿ボタンタップとか? | |
- (IBAction)postTwitter:(id)sender { | |
// Twitterアカウントが端末に設定されているか? | |
if ( ! [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SquareView extends View { | |
private boolean mAdjustWidth; | |
public SquareView(Context context) { | |
super(context, null); | |
} | |
public SquareView(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NSNotificationのようなもの | |
* 通知で送る情報が詰まったオブジェクト | |
*/ | |
public class MyEventObject extends EventObject { | |
public static final String TAG = "MyEventObject"; | |
public enum EventType { | |
Hoge, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InterstitialActivity extends Activity { | |
private InterstitialAd mInterstitial; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// setup | |
setupInterstitialAd(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# local develop env initialize shell command | |
##### yum update all | |
sudo yum -y update | |
##### edit resolv.conf | |
sudo sed -i -e "1i options single-request-reopen" /etc/resolv.conf | |
##### firewall stop | |
sudo service iptables stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// もともとのUIImageViewを正方形にしてるんで、長さの半分 | |
imgView.layer.cornerRadius = imgView.frame.size.width / 2.f; | |
// はみ出たトコをclipするか | |
imgView.layer.masksToBounds = YES; | |
// 枠線色 | |
imgView.layer.borderColor = [UIColor colorWithRed:255.f/255.f green:192.f/255.f blue:203.f/255.f alpha:1.f].CGColor; | |
// 枠線太さ | |
imgView.layer.borderWidth = 5.f; |