Closed shuyouhui666 closed 2 years ago
self.popupByWindow = [[QMUIPopupMenuView alloc] init]; self.popupByWindow.automaticallyHidesWhenUserTap = YES;// 点击空白地方消失浮层 // self.popupByWindow.tintColor = UIColor.qd_tintColor; self.popupByWindow.maskViewBackgroundColor = [UIColor.grayColor colorWithAlphaComponent:.05];// 使用方法 2 并且打开了 automaticallyHidesWhenUserTap 的情况下,可以修改背景遮罩的颜色 self.popupByWindow.shouldShowItemSeparator = YES; self.popupByWindow.itemHeight = 44; self.popupByWindow.itemConfigurationHandler = ^(QMUIPopupMenuView _Nonnull aMenuView, __kindof QMUIPopupMenuBaseItem _Nonnull aItem, NSInteger section, NSInteger index) { //aItem.menuView.itemTitleColor = UIColor.redColor; aMenuView.itemTitleColor = UIColor.redColor; }; @WeakObj(self) self.popupByWindow.items = @[[QMUIPopupMenuButtonItem itemWithImage:nil title:@"大陆" handler:^(QMUIPopupMenuButtonItem _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"大陆"; self.areaCodeText.text = @"86"; [self.popupByWindow hideWithAnimated:YES]; }], [QMUIPopupMenuButtonItem itemWithImage:nil title:@"港澳台" handler:^(QMUIPopupMenuButtonItem _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"港澳台"; self.areaCodeText.text = @""; [self.areaCodeText resignFirstResponder]; [self.popupByWindow hideWithAnimated:YES]; }], [QMUIPopupMenuButtonItem itemWithImage:nil title:@"海外" handler:^(QMUIPopupMenuButtonItem * _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"海外"; self.areaCodeText.text = @""; [self.areaCodeText resignFirstResponder]; [self.popupByWindow hideWithAnimated:YES]; }]]; self.popupByWindow.sourceView = self.phonelable; [self.popupByWindow showWithAnimated:YES];
self.popupByWindow.itemTitleColor = UIColor.redColor;
颜色是初始化设置的 哈哈哈哈
self.popupByWindow = [[QMUIPopupMenuView alloc] init]; self.popupByWindow.automaticallyHidesWhenUserTap = YES;// 点击空白地方消失浮层 // self.popupByWindow.tintColor = UIColor.qd_tintColor; self.popupByWindow.maskViewBackgroundColor = [UIColor.grayColor colorWithAlphaComponent:.05];// 使用方法 2 并且打开了 automaticallyHidesWhenUserTap 的情况下,可以修改背景遮罩的颜色 self.popupByWindow.shouldShowItemSeparator = YES; self.popupByWindow.itemHeight = 44; self.popupByWindow.itemConfigurationHandler = ^(QMUIPopupMenuView _Nonnull aMenuView, __kindof QMUIPopupMenuBaseItem _Nonnull aItem, NSInteger section, NSInteger index) { //aItem.menuView.itemTitleColor = UIColor.redColor; aMenuView.itemTitleColor = UIColor.redColor; }; @WeakObj(self) self.popupByWindow.items = @[[QMUIPopupMenuButtonItem itemWithImage:nil title:@"大陆" handler:^(QMUIPopupMenuButtonItem _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"大陆"; self.areaCodeText.text = @"86"; [self.popupByWindow hideWithAnimated:YES]; }], [QMUIPopupMenuButtonItem itemWithImage:nil title:@"港澳台" handler:^(QMUIPopupMenuButtonItem _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"港澳台"; self.areaCodeText.text = @""; [self.areaCodeText resignFirstResponder]; [self.popupByWindow hideWithAnimated:YES]; }], [QMUIPopupMenuButtonItem itemWithImage:nil title:@"海外" handler:^(QMUIPopupMenuButtonItem * _Nonnull aItem) { @StrongObj(self) self.phonelable.text = @"海外"; self.areaCodeText.text = @""; [self.areaCodeText resignFirstResponder]; [self.popupByWindow hideWithAnimated:YES]; }]]; self.popupByWindow.sourceView = self.phonelable; [self.popupByWindow showWithAnimated:YES];