这是我的代码.我想添加自己的自定义标注视图而不是iOS默认值.我知道只有左侧标注和右侧标注视图,但我需要添加一个带有我自己的背景和标签的视图工具提示类型.
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *userAnnotationView = nil;
if ([annotation isKindOfClass:MKUserLocation.class])
{
userAnnotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"UserLocation"];
if (userAnnotationView == nil) {
userAnnotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"UserLocation"];
}
else
userAnnotationView.annotation = annotation;
userAnnotationView.enabled = YES;
userAnnotationView.canShowCallout = YES;
userAnnotationView.image = [UIImage imageNamed:@"map_pin.png"];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0,0,141,108)];
view.backgroundColor = [UIColor clearColor];
UIImageView *imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"toltip.png"]];
[view addSubview:imgView];
userAnnotationView.leftCalloutAccessoryView = view;
return userAnnotationView;
}
}
Run Code Online (Sandbox Code Playgroud)

我处理推文取消和完成条件在其完成块它正在工作,当我发送重复推文它显示重复推文错误消息确定没问题但我的问题是在重复错误之后它显示推文已完成消息所以我想停止推文已完成消息如果出现重复的错误消息,请解决我的问题.这是我的工作代码.
self.tweetSheet = [[TWTweetComposeViewController alloc] init];
[self.tweetSheet setInitialText:@"Some message."];
[self.navigationController presentModalViewController:self.tweetSheet animated:YES];
// Called when the tweet dialog has been closed
self.tweetSheet.completionHandler = ^(TWTweetComposeViewControllerResult result)
{
NSString * msg;
if (result == TWTweetComposeViewControllerResultCancelled)
{
msg = @"Tweet compostion was canceled.";
}
else if (result == TWTweetComposeViewControllerResultDone)
{
NSLog(@"result %d",result);
msg = @"Tweet composition completed.";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Tweet Status" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
// Show alert to see how things went...
[self.tweetSheet dismissModalViewControllerAnimated:YES];
// Dismiss …Run Code Online (Sandbox Code Playgroud)