- 选取地位页面
- 创立 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];
}
- 在聊天页子类重写以下办法,并设置代理,present 到子类的对象中。
/*!
扩大性能板的点击回调
@param pluginBoardView 输出扩大性能板 View
@param tag 输出扩大性能 (Item) 的惟一标示
*/
- (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;
}
}
- 聊天页子类须要遵循代理 RCLocationPickerViewControllerDelegate,并实现办法:
/*!
地理位置抉择实现之后的回调
@param locationPicker 地理位置选取的 ViewController
@param location 地位的二维坐标
@param locationName 地位的名称
@param mapScreenShot 地位在地图中的缩略图
@discussion
如果您须要重写地理位置抉择的界面,当抉择地理位置实现后,须要调用此回调告诉 RCConversationViewController 定位已实现,能够进一步生成地位音讯并发送。*/
- (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];
}
- 地位信息页面
- 创立 RCLocationViewController 的子类 LocationViewController
- (void)viewDidLoad {[super viewDidLoad];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"自定义左按钮" style:UIBarButtonItemStyleDone target:self action:@selector(leftItemDidPressed:)];
self.navigationItem.leftBarButtonItem.tintColor = [UIColor redColor];
self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
}
- (void)leftItemDidPressed:(id)sendr {[self dismissViewControllerAnimated:YES completion:nil];
}
/**
* 关上地理位置。开发者能够重写,本人依据经纬度关上地图显示地位。默认应用内置地图
*
* @param locationMessageContent 地位音讯
*/
- (void)presentLocationViewController:(RCLocationMessage *)locationMessageContent {
// LocationViewController 为 RCLocationViewController 的子类
LocationViewController *locationViewController = [[LocationViewController alloc] init];
locationViewController.locationName = locationMessageContent.locationName;
locationViewController.location = locationMessageContent.location;
locationViewController.modalPresentationStyle = UIModalPresentationFullScreen;
UINavigationController *navc = [[UINavigationController alloc] initWithRootViewController:locationViewController];
navc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:navc animated:YES completion:NULL];
}