我有一个UIScrollView
显示和图像,它滚动罚款和一切。我想要做的是在UIScrollView
上添加一个UILabel
来显示图像的标题。我设法做到了这一点,但是当我缩小UILabel
时,不会使用滚动视图进行缩放并保持在屏幕上的相同位置。我该如何做到这一点,使标签与scrollView图像缩放?这里是我的代码有:UILabel缩放与UIScrollView
[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"];
您是否设置了* UILabel *的* autoresizingMask *属性? – voromax 2012-08-04 08:09:34
不,我如何找到这个属性? – 2012-08-04 18:05:44