Skip to content

Instantly share code, notes, and snippets.

View taktamur's full-sized avatar

Takafumi Tamura taktamur

View GitHub Profile
@taktamur
taktamur / ぐるぐる
Last active August 7, 2016 11:41
円グラフアニメーションちっくな何かの試作品。
//
// CircleView.swift
// CircleViewSample
//
// Created by 田村孝文 on 2016/08/07.
// Copyright © 2016年 田村孝文. All rights reserved.
//
import Foundation
import UIKit
@taktamur
taktamur / OpenBox.gif
Last active August 29, 2015 14:17
キーボードにくっついて、縦幅を伸ばせるTextView
OpenBox.gif
@taktamur
taktamur / file0.cs
Last active August 29, 2015 14:05
Xamarinで遊ぶ(4) eventを試す ref: http://qiita.com/paming/items/7317ea756a250143912e
class MainClass
{
public class Hoge
{
// Actionの他に EventHandler<object o, EventArgs e> がある。
public event Action<string> ActionHandler;
// Actionは、 Action Action<T> Action<T1,T2> 〜 Action<T1...T16>まである。
// http://msdn.microsoft.com/ja-jp/library/system.action(v=vs.110).aspx
public void DoAction ()
{
@taktamur
taktamur / UITableViewControllerを継承したクラスの中
Last active August 29, 2015 14:05
Xamarinで遊ぶ(3) objcの「デリゲート」とC#の「イベント」が干渉する ref: http://qiita.com/paming/items/682430866791dfba86e2
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Console.WriteLine ("A1 delegate == nil? {0}", (this.TableView.Delegate == null) ? "YES" : "NO");
Console.WriteLine ("B1 weakDelegate={0}", this.TableView.WeakDelegate.GetType ());
this.TableView.DecelerationStarted += (sender, e) => {
Console.WriteLine ("scrolled.");
};
Console.WriteLine ("A2 delegate == nil? {0}", (this.TableView.Delegate == null) ? "YES" : "NO");
Console.WriteLine ("B2 weakDelegate={0}", this.TableView.WeakDelegate.GetType ());
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
namespace MyTasky.Screens
{
@taktamur
taktamur / AppDelegate.cs
Created August 25, 2014 13:28
Xamarinで遊ぶ(1) 起動するまでのメモ書き ref: http://qiita.com/paming/items/1bb43f55033dc78eb0b9
using System;
//using System.Collections.Generic;
//using System.Linq;
using MonoTouch.Foundation; // NSxxxはこっちに入っている?
using MonoTouch.UIKit; // UIxxxはこっちに入っている
// https://xamarin.com/getting-started/ios にあるサンプル、Taskyを自力で作っていく
//
// XamarinStudio用のgitignoreの作り方
@taktamur
taktamur / file0.txt
Created August 16, 2014 09:30
メモ:UINavigationBarの当たり判定が下にはみ出す、その理由 ref: http://qiita.com/paming/items/ab582d5c1d61794e7433
@interface HitTestNavigationBar : UINavigationBar
@end
@implementation HitTestNavigationBar
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
NSLog( @"hitTest point.y=%.1f",point.y);
if ([self pointInside:point withEvent:event]) {
self.userInteractionEnabled = YES;
} else {
self.userInteractionEnabled = NO;
@taktamur
taktamur / file0.txt
Created August 5, 2014 14:46
ステータスバーをタップした時に、一番上ではなく途中にスクロールさせたい時の書き方 ref: http://qiita.com/paming/items/fde55a74f4e98664322e
#pragma mark - UIScrollViewDelegate
- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
{
// section=1までスクロールする
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:1];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
// システム的な自動スクロールは停止
return NO;
}
@taktamur
taktamur / file0.txt
Created July 9, 2014 16:08
UIButtonで、画像とタイトルの位置を入れ替える時にハマった話 (UIEdgeInsets) ref: http://qiita.com/paming/items/a3b61dff825070f8ef40
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// ボタンの画像とtitleを入れ替え
// ButtonAは入れ替えない。
NSLog(@"self.buttonA.titleLabel=%@",self.buttonA.titleLabel);
NSLog(@"self.buttonA.imageView=%@",self.buttonA.imageView);
// ButtonBは、「移動させる方向に-1*サイズ分」設定してみる
CGFloat titleWidthB = self.buttonB.titleLabel.bounds.size.width;
@taktamur
taktamur / gist:5f96ce6e89dbdc342842
Created June 29, 2014 07:08
Deferredの実装をswiftで書いてみた Playgroundに貼付けて動く
import Cocoa
// http://qiita.com/saiten/items/c2ac4df40ad001179afa
// https://github.com/saiten/STDeferred/blob/master/STDeferred/STDeferred.m
// を参考にした。
class PAMDeferred{
class func deferred()->PAMDeferred{
return PAMDeferred()