私のプロジェクトにはUIPopoverControllerがあります。Xcode PopOver - クロスファイル機能を使用していますか?
ファイル構成
Mainfile.h Mainfile.m Mainfile.xib(VIEW)
tableview.h tableview.m tableview.xib(テーブルビュー)
私は私を入れて私のメインファイル内の私のPopoverControllerのためのメソッド。私の問題は、テーブルの行を選択するとmainfile.mからtableview.mにメソッドをアクセスできないということです。
私のコード
Mainfile.h
UIPopoverController *popMenu;
@property(nonatomic,retain) IBOutlet UIPopoverController *popMenu;
-(IBAction)showPopOverid) sender;
-(IBAction)hidePopOver;
Mainfile.m
#import "tableview.h"
-(IBAction)showPopOverid) sender {
if ([popMenu isPopoverVisible]) {
[popMenu dismissPopoverAnimated:YES];
} else {
tableview *toc = [[tocView alloc] init];
popMenu = [[UIPopoverController alloc] initWithContentViewController:toc];
[toc release];
[popMenu presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAn y animated:YES];
}
}
-(IBAction)hidePopOver {
NSLog(@"hidePopOver");
[popMenu dismissPopoverAnimated:YES];
}
他のファイルに
tableview.m
- (void)tableViewUITableView *)tableView didSelectRowAtIndexPathNSIndexPath *)indexPath {
//I WANT TO ACCESS THE METHOD of hidePopOver from the mainfile so i can hide my popViewController
// i've tried a lot but not working
NSLog(@"hidePopOver");
}
あらかじめありがとう