
IM即时通讯
安全可靠、全球互通

实时音视频
流畅稳定、省钱省力
回答:
1.创建 RCLocationPickerViewController 的子类:RCDLocationViewController,可以实现自定义导航栏左右按钮,代码如下:
- (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"自定义左按钮" style:UIBarButtonItemStyleDone target:self action:@selector(leftItemDidPressed:)]; self.navigationItem.leftBarButtonItem.tintColor = [UIColor redColor]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"自定义右按钮" style:UIBarButtonItemStyleDone target:self action:@selector(rightItemDidPressed:)]; self.navigationController.navigationBar.barTintColor = [UIColor blueColor]; } - (void)leftItemDidPressed:(id)sendr { [self dismissViewControllerAnimated:YES completion:nil]; } - (void)rightItemDidPressed:(id)sendr { [super rightBarButtonItemPressed:nil]; }
2.在聊天页子类重写以下下方法,并设置代理,present 到子类的对象中。
- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag { switch (tag) { case PLUGIN_BOARD_ITEM_LOCATION_TAG: { RCDLocationViewController *vc = [[RCDLocationViewController alloc] init]; vc.delegate = self; UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:vc]; [self presentViewController:navi animated:YES completion:nil]; } break; default: [super pluginBoardView:pluginBoardView clickedItemWithTag:tag]; break; } }
3.聊天页子类需要遵循代理 RCLocationPickerViewControllerDelegate,并实现方法:
- (void)locationPicker:(RCLocationPickerViewController *)locationPicker didSelectLocation:(CLLocationCoordinate2D)location locationName:(NSString *)locationName mapScreenShot:(UIImage *)mapScreenShot { RCLocationMessage *locationMessage = [RCLocationMessage messageWithLocationImage:mapScreenShot location:location locationName:locationName]; [self sendMessage:locationMessage pushContent:nil]; }