Skip to content

Instantly share code, notes, and snippets.

#import <Foundation/Foundation.h>
typedef void(^HTTPLoaderCompleteBlock)(NSData *data, NSError *error);
@interface HTTPLoader : NSObject
+(void)loadAsync:(NSURLRequest *)request complete:(HTTPLoaderCompleteBlock)completion;
@end
@fmtonakai
fmtonakai / CustomAlertView.h
Created September 4, 2012 02:20
Custom AlertView with Interface Builder
//
// CustomAlertView.h
// CustomAlert
//
// Created by masaki.fuke on 2012/08/23.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>
@fmtonakai
fmtonakai / UIImage+Blur.h
Created November 26, 2012 02:59
UIImage Blur
//
// UIImage+Blur.h
// HTTPLoaderTest
//
// Created by masaki.fuke on 12/08/14.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>
@fmtonakai
fmtonakai / ActivityText.h
Last active December 14, 2015 15:19
UIActivityViewControllerでTwitterの時だけハッシュタグを追加する
#import <Foundation/Foundation.h>
@interface ActivityText : NSObject <UIActivityItemSource>
-(id)initWithText:(NSString *)text hashTag:(NSString *)hashTag;
@end
@fmtonakai
fmtonakai / gist:5106823
Last active December 14, 2015 15:19
普通にUIActivityViewControllerで共有する場合
-(void)openActivityController
{
NSString *text = @"本文はこちらです。 #ハッシュタグ";
UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:@[text] applicationActivities:nil];
[self presentViewController:avc animated:YES completion:nil];
}
@fmtonakai
fmtonakai / gist:5106889
Created March 7, 2013 09:56
UIActivityViewControllerでTwitterの時だけハッシュタグをつける実装呼び出し
- (IBAction)share:(id)sender
{
ActivityText *text = [[ActivityText alloc] initWithText:@"本文はこちらです。" hashTag:@"ハッシュタグ"];
UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:@[text] applicationActivities:nil];
[self presentViewController:avc animated:YES completion:nil];
}
typedef id (^ActivitySourceWrapperExecuteBlock)(UIActivityViewController* activityViewController,NSString* activityType);
@interface ActivitySourceWrapper : NSObject<UIActivityItemSource>
@property id placeholder;
-(id)initWithBlock:(ActivitySourceWrapperExecuteBlock)block;
-(id)initWithBlock:(ActivitySourceWrapperExecuteBlock)block withPlaceholder:(id)placeholder;
@end
@fmtonakai
fmtonakai / UITableViewCell+IndexPath.h
Created July 9, 2013 07:52
UITableViewCellのカテゴリ
#import <UIKit/UIKit.h>
@interface UITableViewCell (IndexPath)
-(UITableView *)tableView;
-(NSIndexPath *)indexPath;
@end
@fmtonakai
fmtonakai / SwitchCell.h
Created July 9, 2013 08:12
accessoryViewにUISwitchを仕掛けたCell
#import <UIKit/UIKit.h>
// delegate method定義
@protocol UITableViewDelegateSwitchCell <UITableViewDelegate>
@optional
-(void)tableView:(UITableView *)tableView didChangeValue:(BOOL)value forRowWithIndexPath:(NSIndexPath *)indexPath;
@end
@interface SwitchCell : UITableViewCell
@fmtonakai
fmtonakai / ViewController.m
Created July 9, 2013 08:13
実際に使ってみる
#import "ViewController.h"
#import "SwitchCell.h"
@interface ViewController () <UITableViewDataSource, UITableViewDelegateSwitchCell>
@end
@implementation ViewController
- (void)viewDidLoad