Use autoMenuWidth option in popover menu.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2019-10-30 17:08:11 +01:00
Родитель 6a08323d04
Коммит bd2df429ea
2 изменённых файлов: 4 добавлений и 4 удалений

2
ThirdParty/FTPopOverMenu поставляемый

@ -1 +1 @@
Subproject commit 577a5946b819aaa2506ee1fd0e6e30335c2665f6 Subproject commit 7ddb72391bab1df15c510f709915285cd3243ec2

Просмотреть файл

@ -252,7 +252,7 @@ typedef void (^FetchRoomsCompletionBlock)(BOOL success);
NSMutableArray *menuArray = [NSMutableArray new]; NSMutableArray *menuArray = [NSMutableArray new];
NSMutableArray *actionsArray = [NSMutableArray new]; NSMutableArray *actionsArray = [NSMutableArray new];
for (TalkAccount *account in [TalkAccount allObjects]) { for (TalkAccount *account in [TalkAccount allObjects]) {
NSString *accountName = [NSString stringWithFormat:@"%@ (%@)", account.userDisplayName, [[NSURL URLWithString:account.server] host]]; NSString *accountName = account.userDisplayName;
UIImage *accountImage = [[NCAPIController sharedInstance] userProfileImageForAccount:account withSize:CGSizeMake(72, 72)]; UIImage *accountImage = [[NCAPIController sharedInstance] userProfileImageForAccount:account withSize:CGSizeMake(72, 72)];
UIImageView *accessoryImageView = (account.active) ? [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox-checked"]] : nil; UIImageView *accessoryImageView = (account.active) ? [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox-checked"]] : nil;
FTPopOverMenuModel *accountModel = [[FTPopOverMenuModel alloc] initWithTitle:accountName image:accountImage selected:NO accessoryView:accessoryImageView]; FTPopOverMenuModel *accountModel = [[FTPopOverMenuModel alloc] initWithTitle:accountName image:accountImage selected:NO accessoryView:accessoryImageView];
@ -260,16 +260,16 @@ typedef void (^FetchRoomsCompletionBlock)(BOOL success);
[actionsArray addObject:account]; [actionsArray addObject:account];
} }
FTPopOverMenuModel *addAccountModel = [[FTPopOverMenuModel alloc] initWithTitle:@"Add account" image:[UIImage imageNamed:@"add-settings"] selected:NO accessoryView:nil]; FTPopOverMenuModel *addAccountModel = [[FTPopOverMenuModel alloc] initWithTitle:@"Add account" image:[UIImage imageNamed:@"add-settings"] selected:NO accessoryView:nil];
FTPopOverMenuConfiguration *menuConfiguration = [[FTPopOverMenuConfiguration alloc] init];
[menuArray addObject:addAccountModel]; [menuArray addObject:addAccountModel];
[actionsArray addObject:@"AddAccountAction"]; [actionsArray addObject:@"AddAccountAction"];
FTPopOverMenuConfiguration *menuConfiguration = [[FTPopOverMenuConfiguration alloc] init];
menuConfiguration.menuIconMargin = 12; menuConfiguration.menuIconMargin = 12;
menuConfiguration.menuTextMargin = 12; menuConfiguration.menuTextMargin = 12;
menuConfiguration.imageSize = CGSizeMake(24, 24); menuConfiguration.imageSize = CGSizeMake(24, 24);
menuConfiguration.separatorInset = UIEdgeInsetsMake(0, 48, 0, 0); menuConfiguration.separatorInset = UIEdgeInsetsMake(0, 48, 0, 0);
menuConfiguration.menuRowHeight = 44; menuConfiguration.menuRowHeight = 44;
menuConfiguration.menuWidth = 250; menuConfiguration.autoMenuWidth = YES;
menuConfiguration.textColor = [UIColor darkTextColor]; menuConfiguration.textColor = [UIColor darkTextColor];
menuConfiguration.textFont = [UIFont systemFontOfSize:15]; menuConfiguration.textFont = [UIFont systemFontOfSize:15];
menuConfiguration.backgroundColor = [UIColor whiteColor]; menuConfiguration.backgroundColor = [UIColor whiteColor];