Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix anchor and index path of ObjC popup demo #2078

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ - (instancetype)init {
self = [super init];
if (self != nil)
{
_selectedCityIndex = [[NSIndexPath alloc] initWithIndex:0];
_selectedCityIndex = [NSIndexPath indexPathForItem:2 inSection:1];
}
return self;
}
Expand All @@ -21,7 +21,7 @@ - (void)loadView {
[super loadView];
MSFButton *demoButton = [[MSFButton alloc] initWithStyle:MSFButtonStyleOutlineAccent];
[demoButton setTitle:@"Show PopupMenu" forState:UIControlStateNormal];
[demoButton addTarget:self action:@selector(showPopupMenu) forControlEvents:UIControlEventTouchUpInside];
[demoButton addTarget:self action:@selector(showPopupMenu:) forControlEvents:UIControlEventTouchUpInside];

UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[demoButton]];
[stack setAlignment:UIStackViewAlignmentTop];
Expand All @@ -41,7 +41,7 @@ - (void)loadView {
]];
}

- (void)showPopupMenu {
- (void)showPopupMenu:(id)sender {
MSFPopupMenuItem *montreal = [[MSFPopupMenuItem alloc] initWithImageName:@"Montreal"
generateSelectedImage:NO
title:@"Montréal"
Expand Down Expand Up @@ -112,9 +112,8 @@ - (void)showPopupMenu {
items:@[montreal, toronto, vancouver]];
MSFPopupMenuSection *unitedStates = [[MSFPopupMenuSection alloc] initWithTitle:@"United States"
items:@[lasVegas, phoenix, sanFrancisco, seattle]];
UIView *source = [self view];
MSFPopupMenuController *popupMenu = [[MSFPopupMenuController alloc] initWithSourceView:source
sourceRect:[source bounds]
MSFPopupMenuController *popupMenu = [[MSFPopupMenuController alloc] initWithSourceView:sender
sourceRect:[sender bounds]
presentationOrigin:-1
presentationDirection:MSFDrawerPresentationDirectionDown
preferredMaximumHeight:-1];
Expand Down
Loading