我有一個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