room_members_search

Add a dedicated delete button instead of the sliding menu.
This commit is contained in:
yannick
2015-12-18 16:00:38 +01:00
parent 9c64a33638
commit 29a3ca8e4e
3 changed files with 67 additions and 28 deletions
@@ -18,6 +18,10 @@
#import "AppDelegate.h"
#import "VectorContactTableViewCell.h"
#import "VectorDesignValues.h"
@interface RoomCreationStep2ViewController ()
{
UIBarButtonItem *createBarButtonItem;
@@ -102,8 +106,70 @@
super.isAddParticipantSearchBarEditing = isAddParticipantSearchBarEditing;
}
#pragma mark - UITableView delegate
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [[NSMutableArray alloc] init];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
if ([cell isKindOfClass:[VectorContactTableViewCell class]])
{
cell.accessoryView = nil;
if (indexPath.section == participantsSection)
{
if (!userMatrixId || (indexPath.row != 0))
{
UIImageView* accessView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
accessView.image = [UIImage imageNamed:@"remove_icon"];
accessView.tag = indexPath.row;
accessView.userInteractionEnabled = YES;
UITapGestureRecognizer * accessViewTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDeleteTap:)];
[accessViewTapGesture setNumberOfTouchesRequired:1];
[accessViewTapGesture setNumberOfTapsRequired:1];
[accessView addGestureRecognizer:accessViewTapGesture];
cell.accessoryView = accessView;
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
else
{
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
}
}
return cell;
}
#pragma mark - Actions
- (void)onDeleteTap:(UIGestureRecognizer*)gestureRecognizer
{
NSInteger row = gestureRecognizer.view.tag;
if (userMatrixId)
{
row --;
}
if (row < mutableParticipants.count)
{
[mutableParticipants removeObjectAtIndex:row];
[self.tableView reloadData];
}
}
- (IBAction)onButtonPressed:(id)sender
{
if (sender == createBarButtonItem && _roomCreationInputs.mxSession)