こんにちは仲間、私はUILabelのサブビューとしてUIButtonを使用し、そのボタンをクリックするとポップアップが開くのを見つけました。ポップアップがそのボタンから離れて開いていることがわかりました。その背後にある理由は何ですか。助けてください。ありがとうございます。私のコードは次のとおりです。
sortBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[sortBtn setTitle:@"Sort" forState:UIControlStateNormal];
[sortBtn setBackgroundColor:[UIColor colorWithRed:0.137 green:0.384 blue:0.871 alpha:1.0]];
[sortBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:16.0f]];
[sortBtn addTarget:self action:@selector(sortTheData:) forControlEvents:UIControlEventTouchUpInside];
sortBtn.frame=CGRectMake(195,5, 53, 28);
[categoryLabel setUserInteractionEnabled:YES];
[categoryLabel addSubview:sortBtn];
sorttheDataメソッドは次のとおりです。
SortByController *sortController = [[SortByController alloc] initWithNibName:@"SortByController" bundle:nil];
sortController.dataArray = self.dataAllPerformances;
sortController.sortString =self.sortString;
sortController.genreId = [NSString stringWithFormat:@"%d",self.genreId];
sortController._delegate = self;
self.popController = [[UIPopoverController alloc] initWithContentViewController:sortController];
//popController.delegate = self;
popController.popoverContentSize = CGSizeMake(230, 260);
[popController presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[sortController release];