通過幀我在settings.plist定義的框架和在我的課accesing它作爲一個字符串,而通過它給出了一個錯誤:問題從setting.plist
下面的代碼:
NSString * frame = [selectable objectForKey:@"Frame"];
[self selectButtons:@"Select." andFrame:frame andValue:goal];
-(void)selectButtons:(NSString *)text andFrame:(NSString *)frame andValue:(int)goal
{
UIColor * c = [UIColor clearColor];
UIFont * font = BUTTON_TITLE;
UIColor * f = DESC_Color_White;
select = [ApplicationHelpers buttonWithTitle:text andBgColor:c andTitleColor:f andTitleFont:font];
CGRect frame1 = frame; -------->>>>>> gives error here
select.frame = frame1;
UIImage * buttonImage = [UIImage imageNamed:@"scneariosButtonSmall1.png"];
UIImage * strechableButtonImage = [buttonImage stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[select setBackgroundImage:strechableButtonImage forState:UIControlStateNormal];
[select addTarget:self action:@selector(selectClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:select];
}
請給我一些關於這個的提示?
謝謝,
這工作,但唯一的是我通過我的框架作爲CGRectMake(20,30,150,54)和調試時,我檢查它沒有給任何價值。我的意思是x,y,寬度和高度都是零。所以我需要以不同的方式在我的設置文件中定義框架。 – Ashutosh 2011-04-04 18:42:33
@Ashu:你的意思是字符串'frame'是'@「CGRectMake(20,30,150,54)」'? – kennytm 2011-04-04 18:44:04
是的.....我發現它應該像這樣定義:{{x,y},{w,h}} – Ashutosh 2011-04-04 18:50:32