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 "YMNViewController.h" | |
NSString *const Text = @"The iOS Developer Program provides a complete and integrated process for developing and distributing iOS apps on the App Store. Learn more"; | |
NSString *const LinkText = @"Learn more"; | |
@interface YMNViewController () | |
@property (nonatomic, strong) UITextView *textView; | |
@property (nonatomic, strong) UITapGestureRecognizer *tapGesture; |
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
// サンプル動画のパスを取得 | |
let bundle = NSBundle.mainBundle() | |
let url: NSURL = NSBundle.mainBundle().URLForResource("sample", withExtension: "mp4")! | |
// 動画のパスを指定してplayerItemを生成 | |
self.playerItem = AVPlayerItem(URL: url) | |
// 上で生成したplayerItemを指定してplayerを生成 | |
self.videoPlayer = AVPlayer(playerItem: self.playerItem) | |
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 "UIButton+block.h" | |
#import <objc/runtime.h> | |
static char BUTTON_BLOCK; | |
@implementation UIButton (block) | |
- (void)addBlock:(void (^)(void))block forControlEvents:(UIControlEvents)event { | |
self.didTapped = block; | |
[self addTarget:self action:@selector(callBlock:) forControlEvents:event]; |
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 <UIKit/UIKit.h> | |
@interface UIButton (block) | |
@property (nonatomic, copy) void (^didTapped)(); | |
- (void)addBlock:(void (^)(void))block forControlEvents:(UIControlEvents)event; | |
@end |
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
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)]; | |
label.font = [UIFont systemFontOfSize:10.f]; | |
[self.view addSubview:label]; | |
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:@"UILabelにNSAttributedStringを表示〆(∀`*)"]; | |
NSDictionary *attributes = @{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)}; // ここではアンダーラインをセット | |
[attrStr addAttributes:attributes range:NSMakeRange(0, attrStr.length)]; | |
label.attributedText = attrStr; |
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
CAGradientLayer *gradientLayer = [CAGradientLayer layer]; | |
//レイヤをビューの中央に配置する | |
gradientLayer.bounds = self.layer.bounds; | |
gradientLayer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); | |
gradientLayer.startPoint = CGPointMake(0, CGRectGetMidY(self.frame)); //開始ポイント | |
gradientLayer.endPoint = CGPointMake(1, CGRectGetMidY(self.frame)); //終了ポイント | |
id opaque = (id)[UIColor blackColor].CGColor; //開始色 |
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
<form enctype="multipart/form-data" action="アクション" method="post"> | |
<input type="file" name="movie" /><br /> | |
<br /> | |
<input type="submit" value="送信" /> | |
</form> |
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
$updir = "./movies/"; | |
$filename = $_FILES['movie']['name']; | |
//is_uploaded_file でファイルがアップロードされたかどうか調べる | |
if (is_uploaded_file($_FILES["movie"]["tmp_name"])) { | |
//move_uploaded_file を使って一時的な保存先から指定のフォルダに移動させる | |
if (move_uploaded_file($_FILES["movie"]["tmp_name"], $updir.$filename)) { | |
var_dump("成功"); | |
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 "YSViewController.h" | |
@interface YSViewController () | |
@end | |
@implementation YSViewController | |
- (void)viewDidLoad { | |
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 "UIAlertView+Block.h" | |
#import <objc/runtime.h> | |
static char CANCEL_BUTTON_BLOCK; | |
static char OTHER_BUTTON_BLOCK; | |
@implementation UIAlertView (Block) | |
+ (UIAlertView*)alertViewWithTitle:(NSString *)title | |
message:(NSString *)message |
NewerOlder