如何將白色背景添加到.png UIImage
文件與HSImageSidebarView?使用HSImageSidebarView將白色背景添加到.png UIImage文件
我已經嘗試創建一個UIImageView
,然後顯示在側邊欄,但不幸的是應用程序崩潰與NSException。任何有關如何將白色背景添加到側欄上的圖像文件的想法,如果它們是UIImage
而不是UIImageView
。
如何將白色背景添加到.png UIImage
文件與HSImageSidebarView?使用HSImageSidebarView將白色背景添加到.png UIImage文件
我已經嘗試創建一個UIImageView
,然後顯示在側邊欄,但不幸的是應用程序崩潰與NSException。任何有關如何將白色背景添加到側欄上的圖像文件的想法,如果它們是UIImage
而不是UIImageView
。
你會嘗試將此代碼添加上一個筆尖滾動視圖,並設置其contentsize上的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.
我檢查FOT如果你想要我給你寫嘗試爲 – vishiphone
一個代碼,美應使用滾動視圖,並在他們在不同的不同的位置創建視圖如果這個答案是有幫助因爲你請告訴我們,這對其他人會有幫助。 – vishiphone
這沒有用 –