如何使用HSImageSidebarViewUIImage
向 .png文件添加白色背景?
我曾尝试UIImageView
在侧边栏上创建一个然后显示它,但不幸的是,该应用程序因 NSException 而崩溃。如果它们是 aUIImage
而不是UIImageView
.
如何使用HSImageSidebarViewUIImage
向 .png文件添加白色背景?
我曾尝试UIImageView
在侧边栏上创建一个然后显示它,但不幸的是,该应用程序因 NSException 而崩溃。如果它们是 aUIImage
而不是UIImageView
.
您将尝试此代码在 nib 上添加一个滚动视图并在 viewdidload 上设置其内容大小
CGFloat x = 20;
for (int i = 0;i<[playerScores count];i++) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x, 10, 60, 60)];
view.backgroundColor=[UIColor blueColor];
NSString *text = [NSString stringWithFormat:[playerScores objectAtIndex:i]];
[view setText:text];
[yardsScrollView addSubview:view];
[myLabel release];
x = x+125;
}
PlayersScore 是一个 NSMutable 数组,其中包含许多文本,例如您想要多少视图。
@objc-痴迷
You will need to loop through the subviews to find whether it is of kind UIImage or UIImageView by this:
id object;
if([object isKindOfClass:[UIImage Class]]) {
//Do whatever u want to here by creating a new imageView on the top of this image
//Something like this:
UIImage *image =(UIImage*)object;
UIImageView *imgView=[[uiimageview alloc]initwithimage:image];
//Now perform the background view operations on imgView i.e. instance of UIImageView.
}
//Hope it works.