jos*_*osh 3 iphone xcode uitableview uiswitch ios
我想调整UISwitch附加的按钮的大小UITableView.我在google上找到了一些帮助,并成功使用CGAffineTransformMakeScale了这个但是我得到了一个问题,当我改变位置这个开关按钮它自己的原始大小可能是因为它在表视图但我在ViewDidLoad委托中调整大小.这就是我在做的事情.
- (void)viewDidLoad{
switchFB = [[UISwitch alloc] initWithFrame:CGRectMake(227, 8, 79, 27)];
switchFB.transform= CGAffineTransformMakeScale(0.7, 0.7);}
Run Code Online (Sandbox Code Playgroud)
在索引路径的行中的单元格中
- (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;
}
Run Code Online (Sandbox Code Playgroud)
请检查我在哪里做错了,如果我的程序不对,那么请你建议我做一些更好的方法.这对我来说很棒.提前致谢.
试试这个
UISwitch *mySwitch = [UISwitch new];
mySwitch.transform = CGAffineTransformMakeScale(0.75, 0.75);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6771 次 |
| 最近记录: |