我有一个UIScrollView
显示和图像,它可以很好地滚动和一切。我想要做的是添加一个UILabel
来UIScrollView
显示图像的标题。我设法做到了,但是当我缩小时UILabel
,滚动视图不会缩放并保持在屏幕上的同一位置。我将如何使标签与滚动视图图像一起缩放?这是我的代码:
[super viewDidLoad];
// Do any additional setup after loading the view.
self.scrollView.delegate = self;
//This just creates a image from a URL
NSURL * photoURL = [FlickrFetcher urlForPhoto:self.photoCellName format:2];
NSData * photoData = [NSData dataWithContentsOfURL:photoURL];
self.imageView.image = [UIImage imageWithData:photoData];
//Setting up scroll View
self.scrollView.contentSize= self.imageView.image.size;
self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
NSLog(@"Name = %@", [self.photoCellName valueForKeyPath:@"description._content"]);
//Assigning title to the label
self.textLabel.text = [self.photoCellName objectForKey:@"title"];