Skip to content

Commit

Permalink
realm 파일 불러오기 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
krazyeom committed Oct 10, 2014
1 parent a6327cd commit 4b4caa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions iKTV/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

NSString *path = [[NSBundle mainBundle] pathForResource:@"ktv" ofType:@"realm"];
[RLMRealm realmWithPath:path]; // Create realm pointing to default file

ListTableViewController *left = [[ListTableViewController alloc] initWithStyle:UITableViewStylePlain];
CreditsViewController *right = [[CreditsViewController alloc] init];
_center = [[VideoViewController alloc] init];
Expand Down
8 changes: 6 additions & 2 deletions iKTV/ListTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

@interface ListTableViewController ()
@property (strong) RLMArray *channels;
@property (strong) RLMArray *server;
@end

@implementation ListTableViewController

- (void)viewDidLoad {
_channels = [Channel allObjects];
NSString *path = [[NSBundle mainBundle] pathForResource:@"ktv" ofType:@"realm"];
RLMRealm *realm = [RLMRealm realmWithPath:path]; // Create realm pointing to default file
_channels = [Channel allObjectsInRealm:realm];
_server = [Server allObjectsInRealm:realm];
[super viewDidLoad];
}

Expand Down Expand Up @@ -60,7 +64,7 @@ - (NSString *)channelTitleWithIndex:(NSInteger)index {

- (NSString *)channelURLWithIndex:(NSInteger)index {
NSInteger serverInteger = RAND_FROM_TO(12, 15);
NSString *temp1 = [(Server *)[[Server allObjects] firstObject] url];
NSString *temp1 = [(Server *)[_server firstObject] url];
NSString *temp2 = [@(serverInteger) stringValue];
NSString *temp3 = [(Channel *)[_channels objectAtIndex:index] channelNum];
NSString *temp4 = [(Channel *)[_channels objectAtIndex:index] quality];
Expand Down

0 comments on commit 4b4caa1

Please sign in to comment.