我想調整我的UISwitch
按鈕的大小,該按鈕附在UITableView
上。我在谷歌上找到了一些幫助,併成功地使用了CGAffineTransformMakeScale
,但使用這個我得到一個問題,當我改變位置這個開關按鈕時,它變成了它自己的原始尺寸,可能是因爲它在桌面視圖上,但我在ViewDidLoad
代表中調整了這個尺寸。這是我正在做的。如何調整UISwitch按鈕的大小?
- (void)viewDidLoad{
switchFB = [[UISwitch alloc] initWithFrame:CGRectMake(227, 8, 79, 27)];
switchFB.transform= CGAffineTransformMakeScale(0.7, 0.7);}
,並在索引路徑細胞爲行
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{`static NSString *CellIdentifier = @"SettingsCell";`
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}
請檢查這個地方我做錯了,如果我的方法是不正確的方式,以便可以請你建議我一些更好的方式來做到這一點。這對我來說很好。提前致謝。
你有沒有仔細閱讀我的問題,巴迪我正在做同樣的事情你在暗示。 – josh 2013-03-04 07:35:40
是的,您需要根據您的需要更改0.75。這是什麼爲我工作mySwitch.transform = CGAffineTransformMakeScale(1.25,1.1);我在解決上述問題時遇到了同樣的問題。 – Minakshi 2013-03-04 08:04:21
我也在做同樣的事情在視圖加載方法,因爲我提到過。 switchFB.transform = CGAffineTransformMakeScale(0.7,0.7);}它也調整開關按鈕大小。 – josh 2013-03-04 08:19:03