Skip to content

Instantly share code, notes, and snippets.

@g-1
g-1 / file0.txt
Last active October 15, 2016 17:36
Xcode8になっていろいろ変わったこと ref: http://qiita.com/g-1/items/7fb052e05369c2540f40
- override func activityType() -> String? {
- return "XXXX"
+ override var activityType : UIActivityType {
+ return UIActivityType(rawValue: "XXXX")
}
@g-1
g-1 / LoginViewController.swift
Last active December 31, 2015 10:45
FabricでTwitterのタイムラインを表示する(サンプル版) ref: http://qiita.com/g-1/items/43ecf43dd997af9f99bb
import UIKit
import TwitterKit
class LoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let logInButton = TWTRLogInButton { (session, error) in
@g-1
g-1 / LoginViewController.swift
Last active December 31, 2015 10:34
FebricでTwitterのタイムラインを表示する(Xcode7.2版) ref: http://qiita.com/g-1/items/05e20de236fb486cb84c
import UIKit
import TwitterKit
class LoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
/*
let logInButton = TWTRLogInButton { (session, error) in
@g-1
g-1 / file0.txt
Last active September 16, 2015 16:03
UIImagePickerControllerをStoryBoardで表現することがiOS8で出来なくなった。 ref: http://qiita.com/g-1/items/897fb01f43eaab66223e
- (void)doImagePickerController
{
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.allowsEditing = NO;
imagePicker.delegate = self;
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self presentViewController:imagePicker animated:YES completion:nil];
}];
@g-1
g-1 / sepia.shader
Created April 25, 2015 04:28
セピアシェーダーを書いてみる ref: http://qiita.com/g-1/items/1d4a40d76decefd36342
Shader "Sprites/Sepia"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
SubShader
Shader "Sprites/Monochrome"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
SubShader
@g-1
g-1 / Handler.java
Last active August 29, 2015 14:06
cocos2d-xのtouchイベント内でtoastを表示したいとき。 ref: http://qiita.com/g-1/items/0323cd56a53029f1fa65
public Handler(Callback callback, boolean async) {
if (FIND_POTENTIAL_LEAKS) {
final Class<? extends Handler> klass = getClass();
if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) &&
(klass.getModifiers() & Modifier.STATIC) == 0) {
Log.w(TAG, "The following Handler class should be static or leaks might occur: " +
klass.getCanonicalName());
}
}
@g-1
g-1 / PopupViewController.m
Last active August 29, 2015 14:05
iOSでポップアップビューを実装する(with Storyboard) ref: http://qiita.com/g-1/items/970d9101bdd14cbceffd
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
}
@g-1
g-1 / PopupViewController.m
Created August 23, 2014 15:19
iOSでポップアップビューの自作を行う。 ref: http://qiita.com/g-1/items/bbf785e32bdfb66eb714
- (IBAction)close:(id)sender
{
[UIView animateWithDuration:0.2f
animations:^{
self.view.alpha = 0.2f;
}
completion:^(BOOL finished){
[self.view removeFromSuperview];
self.view.alpha = 1.f;
@g-1
g-1 / file0.txt
Created July 10, 2014 15:19
UITableViewController+CoreDataでセクション内セルを削除を行う場合 ref: http://qiita.com/g-1/items/549402748573adf46acc
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
//...
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}