【发布时间】:2023-09-18 12:54:01
【问题描述】:
我想调整我的UISwitch 按钮的大小,该按钮附加在UITableView 上。我在 google 上找到了一些帮助,并使用CGAffineTransformMakeScale 成功完成了此操作,但是当我更改此开关按钮的位置时,我遇到了一个问题,它具有自己的原始大小可能是因为它在桌面视图上,但我在@987654324 中调整了它的大小@ 代表。这就是我正在做的事情。
- (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;
}
请检查我做错的地方,如果我的程序不正确,请您建议我一些更好的方法来做到这一点。这对我来说会很棒。提前致谢。
【问题讨论】:
标签: iphone ios xcode uitableview uiswitch