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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"places.plist"]; | |
// NSKeyedArchiverを使ってNSData型に変換 | |
NSData *data1 = [NSKeyedArchiver archivedDataWithRootObject:customObj1]; | |
NSData *data2 = [NSKeyedArchiver archivedDataWithRootObject:customObj2]; | |
NSArray *array = @[data1, data2]; | |
[array writeToFile:[self dataFilePath] atomically:YES]; |
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
// ☆.。.:* CustomObject.h *・°☆*:.. | |
@interface CustomObject : NSObject <NSCoding> // NSCodingプロトコルを利用 | |
NSString *name; | |
NSString *address; | |
@end | |
// ☆.。.:* CustomObject.m *・°☆*:.. | |
// デシリアライズの際に呼ばれる |
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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"places.plist"]; | |
NSArray *array = @[customObj1, customObj2]; | |
[array writeToFile:[self dataFilePath] atomically:YES]; |
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 { | |