-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetailViewController.m
More file actions
31 lines (27 loc) · 1022 Bytes
/
DetailViewController.m
File metadata and controls
31 lines (27 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// DetailViewController.m
// Maps
//
// Created by kooshesh on 4/19/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "DetailViewController.h"
@implementation DetailViewController
-(void) loadView
{
[super loadView];
[self.navigationController setNavigationBarHidden: NO];
self.title = @"San Francisco";
NSURL *url = [NSURL URLWithString: @"http://kooshesh.cs.sonoma.edu/cs470/sf_pics/city_1.jpg"];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
UIImage *cityImage = [UIImage imageWithData: data];
UIImageView *image = [[UIImageView alloc] initWithImage:cityImage];
CGRect bounds = [image bounds];
CGRect frame = [[UIScreen mainScreen] applicationFrame];
CGRect imageFrame = CGRectMake( (frame.size.width - bounds.size.width) / 2,
(frame.size.height - bounds.size.height - frame.origin.y) / 2, bounds.size.width, bounds.size.height);
image.frame = imageFrame;
[self.view addSubview:image];
[self.view setBackgroundColor: [UIColor blackColor]];
}
@end