0
我目前擁有可在我的應用程序中動態添加標籤的代碼。不過,我想要完成同樣的事情,但是,而不是標籤,我想要圖像。我怎樣才能做到這一點?我嘗試用「UIImage」替換「UILabel」,但沒有任何工作可以用於我。在iOS中動態添加圖像
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake((xPoint),
(yPoint1),
100.0f,
40.0f)];
label.text = [NSString stringWithFormat:@"+%d", Perclick];
[self.view addSubview:label];
label.font = [UIFont fontWithName:@"MyriadWebPro-Bold" size:21];
label.textColor = [UIColor whiteColor];
[UIView animateWithDuration:1.5
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{ label.alpha = 0.0; label.frame = CGRectMake((touchPoint.x + 40), (yPoint2), 100.0f, 40.0f); }
completion:^(BOOL fin) {
if (fin) [label removeFromSuperview];
}
];
如何使用[UIImageViews](https://developer.apple.com/library/ios/documentation/uikit/reference/UIImageView_Class/Reference/Reference.html)? – vikingosegundo