我有用於顯示文章HTML頁面的UIWebView。我使用UILongGesture來顯示UIMenuController。在UIMenuItem在筆記上有一個字段。如果單擊註釋它將顯示UITextView。但是,如果我在UITextView,UIMenuItem顯示longpress。如何隱藏?刪除UITextView中的UIMenuController
- (void)viewDidLoad
{
NSMutableArray *items = [[[UIMenuController sharedMenuController] menuItems] mutableCopy];
if (!items) items = [[NSMutableArray alloc] init];
UIMenuItem *menuItem;
menuItem = [[UIMenuItem alloc] initWithTitle:@"BookMark" action:@selector(book:)];
[items addObject:menuItem];
[menuItem release];
menuItem = [[UIMenuItem alloc] initWithTitle:@"Notes" action:@selector(note:)];
[items addObject:menuItem];
[menuItem release];
[[UIMenuController sharedMenuController] setMenuItems:items];
[items release];
UILongPressGestureRecognizer *tap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(tapTest:)];
[tap setDelegate:self];
[wbCont.scrollView addGestureRecognizer:tap];
wbCont.userInteractionEnabled=YES;
[self.view addSubview:wbCont];
}
如果使用點擊注:
- (void)note:(id)sender {
NSLog(@"Note");
// wbCont.userInteractionEnabled=NO;
if ([UIMenuController sharedMenuController]) {
[UIMenuController sharedMenuController].menuVisible = NO;
}
txtview = [[UITextView alloc]initWithFrame:CGRectMake(0,0,320,568)];
txtview.font = [UIFont fontWithName:@"Helvetica" size:12];
txtview.font = [UIFont boldSystemFontOfSize:12];
txtview.backgroundColor = [UIColor whiteColor];
txtview.scrollEnabled = YES;
txtview.pagingEnabled = YES;
txtview.editable = YES;
txtview.tag = mainTag*10000;
[self.view addSubview:txtview];
}
我需要設置這個裏面的註釋方法嗎? – user2931119
不工作.. – user2931119