• R/O
  • HTTP
  • SSH
  • HTTPS

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ


File Info

Rev. e9e7cdedf9e5412fbce49efd2ba2a4a1ad8fdd63
크기 1,197 bytes
Time 2011-04-10 09:11:52
Author masakih
Log Message

[Mod] 開くサイトをUserDefaultsに保存するようにした。

Content

//
//  BEUserDefaultsKeys.m
//  BooksExporter
//
//  Created by Hori,Masaki on 11/03/27.
//  Copyright 2011 masakih. All rights reserved.
//

#import "BEPreference.h"


NSString *const BEOpenAfterExported = @"openAfterExported";
NSString *const BEOpenSite = @"targetSite";

static NSString *const BESiteOpenAttributes = @"SiteOpenAttributes";

@implementation BEPreference
static BEPreference *sharedInstance = nil;

+ (BEPreference *)preference
{
	if(sharedInstance) return sharedInstance;
	
	sharedInstance = [[BEPreference alloc] init];
	return sharedInstance;
}

- (id)objectForKey:(NSString *)key
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud objectForKey:key];
}
- (void)setObject:(id)object forKey:(NSString *)key
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setObject:object forKey:key];
}

- (NSArray *)attributes
{
	NSData *data = [self objectForKey:BESiteOpenAttributes];
	if(!data) return nil;
	return [NSKeyedUnarchiver unarchiveObjectWithData:data];
}
- (void)setAttributes:(NSArray *)attributes
{
	NSData *data = [NSKeyedArchiver archivedDataWithRootObject:attributes];
	[self setObject:data forKey:BESiteOpenAttributes];
}

@end