Ios UITableViewRowAction更改字体和/或大小
我有一个UITableView,其中单元格有一些UITableViewRowActions。我们的模型使用更小的字体和更窄的UITableViewRowAction按钮。是否可以以任何方式更改UITableViewRowAction的字体和/或大小Ios UITableViewRowAction更改字体和/或大小,ios,uitableview,ios8,uitableviewrowaction,Ios,Uitableview,Ios8,Uitableviewrowaction,我有一个UITableView,其中单元格有一些UITableViewRowActions。我们的模型使用更小的字体和更窄的UITableViewRowAction按钮。是否可以以任何方式更改UITableViewRowAction的字体和/或大小 声明这是不可能的,因此我询问是否还有其他方法。UITableViewCell由背景视图和内容视图组成,它覆盖backgroundView您可以做的是将ui按钮作为子视图添加到backgroundView中,并在单元格上添加uipangestrerec
声明这是不可能的,因此我询问是否还有其他方法。
UITableViewCell
由背景视图和内容视图组成,它覆盖backgroundView
您可以做的是将ui按钮作为子视图添加到backgroundView
中,并在单元格上添加uipangestrerecognizer
。因此,当您仅水平平移单元格时,contentView
移动,UIButton
s就会暴露出来。因此在cellforrowatinexpath
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *myCell;
myCell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"YOUR_IDENTIFIER"];
//adding button to a view that is added as the backgroundview
UIView *cellBackgroundUtilityView=[[UIView alloc]initWithFrame:myCell.frame];
[cellBackgroundUtilityView addSubview:<your button>]
[myCell setBackgroundView: cellBackgroundUtilityView]
//adding a gesture recognizer
UIPanGestureRecognizer *panningCell=[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(yourPanningTableViewCellMethod:)];
[panningCell setDelegate:self];
[myCell addGestureRecognizer:panningCell];
}
当按钮的选择器被调用时
-(void)yourBackgroundViewButtonWasPressed
{
// button was pressed
// move content view of the cell back to origin
[tableCell.contentView setFrame:CGRectMake(0.0, tableCell.contentView.frame.origin.y, tableCell.frame.size.width, tableCell.frame.size.height)];
//do your stuff
}
UITableViewCell
由backgroundView
和contentView
组成,后者覆盖backgroundView
您可以做的是将UIButton
s作为子视图添加到backgroundView
中,并在单元格上添加UIPangestureRecognitor
。因此,当您仅水平平移单元格时,contentView
移动,UIButton
s就会暴露出来。因此在cellforrowatinexpath
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *myCell;
myCell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"YOUR_IDENTIFIER"];
//adding button to a view that is added as the backgroundview
UIView *cellBackgroundUtilityView=[[UIView alloc]initWithFrame:myCell.frame];
[cellBackgroundUtilityView addSubview:<your button>]
[myCell setBackgroundView: cellBackgroundUtilityView]
//adding a gesture recognizer
UIPanGestureRecognizer *panningCell=[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(yourPanningTableViewCellMethod:)];
[panningCell setDelegate:self];
[myCell addGestureRecognizer:panningCell];
}
当按钮的选择器被调用时
-(void)yourBackgroundViewButtonWasPressed
{
// button was pressed
// move content view of the cell back to origin
[tableCell.contentView setFrame:CGRectMake(0.0, tableCell.contentView.frame.origin.y, tableCell.frame.size.width, tableCell.frame.size.height)];
//do your stuff
}