나는 SO를 검색했고 웹은 에이미 답을 찾지 못했습니다.
스토리 보드 메인 UITableViewController에서 A라는 간단한 버튼이 생성되었습니다. 및 webView 및 닫기 버튼이있는 B라는 다른 ViewController.
주 UITableViewController 어떤 형태로든 연결되어 있지 않습니다.
이제 B viewController 폼을 열고 그 다음 자신의 닫기 단추로 B ViewController를 닫고 싶습니다.
하지만 B 뷰 컨트롤러는 검정색과 검정색으로되어 있습니다.presentView 스토리 보드가있는 컨트롤러가 검은 색으로 보임 iOS 7.1 xcode 5.1
의 ViewController B (나는 B를 열려고되는 메인 뷰 컨트롤러) (팝업 뷰)
#import "TAFBLoginDialogViewController.h"
@interface TAFBLoginDialogViewController()
@end
@implementation TAFBLoginDialogViewController
-(id)initWithAppId:(NSString *)apiKey
requestPremision:(NSString *)requestPremision
delegate:(id<TAFBLoginDialogViewdelegate>)delegate
storyBoardName:(NSString*) storyBoardName
{
//self = [super initWithNibName:@"FBLoginDialog" bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyBoardName bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"FBLoginDialog"];
if (self) {
// Custom initialization
self.apiKey = apiKey;
self.requestPremision = requestPremision;
self.delegate = delegate;
}
return self;
}
- (IBAction)closeTap:(id)sender
{
[self.delegate closeTaped];
}
-(void)login
{
}
-(void)logout
{
}
-(void)checkForAccessToken:(NSString*)urlString
{
}
-(void)checkLoginRequired:(NSString*)urlString
{
[self.delegate displayRequired];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
있는 UITableViewController
#import "TAFMETableViewController.h"
@interface TAFMETableViewController()
{
}
@end
@implementation TAFMETableViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
-(void) awakeFromNib
{
[super awakeFromNib];
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return cell;
}
- (IBAction)handleOpenFBDialog:(id)sender {
UIStoryboard * storyboard = self.storyboard;
NSString * storyboardName = [storyboard valueForKey:@"name"];
self.appId = @"11111";
self.permissions [email protected]"public_stream";
if(_loginDialogView ==nil)
{
self.LoginDialogViewController = [[TAFBLoginDialogViewController alloc] initWithAppId:_appId
requestPremision:_permissions
delegate:self storyBoardName:storyboardName];
self.loginDialogView = _LoginDialogViewController.view;
}
[self.LoginDialogViewController checkLoginRequired:@"tst"];
NSLog(@"Click!");
}
-(void)accessTokenFound:(NSString*)accessToken
{
NSLog(@"accessTokenFound Click!");
}
-(void)displayRequired
{
NSLog(@"displayRequired Click!");
[self presentViewController:_LoginDialogViewController animated:YES completion:nil];
}
-(void)closeTaped
{
NSLog(@"closeTaped Click!");
[self dismissViewControllerAnimated:NO completion:nil];
}
@end
헤더 파일 :
@protocol TAFBLoginDialogViewdelegate
-(void)accessTokenFound:(NSString*)accessToken;
-(void)displayRequired;
-(void)closeTaped;
@end
@interface TAFBLoginDialogViewController : UIViewController<UIWebViewDelegate>
{
//ivars
// UIWebView *_webview;
// NSString* _apiKey;
// NSString* _requestPremision;
// id <TAFBLoginDialogViewdelegate> _delegate;
}
@property (retain) IBOutlet UIWebView *webView;
@property (copy) NSString *apiKey;
@property (copy) NSString *requestPremision;
@property (assign) id<TAFBLoginDialogViewdelegate> delegate;
-(id)initWithAppId:(NSString*)apiKey
requestPremision:(NSString*)requestPremision
delegate:(id<TAFBLoginDialogViewdelegate>)delegate
storyBoardName:(NSString*) storyBoardName;
- (IBAction)closeTap:(id)sender;
-(void)login;
-(void)logout;
-(void)checkForAccessToken:(NSString*)urlString;
-(void)checkLoginRequired:(NSString*)urlString;
@end
나는 그 방아쇠를 TableView A에 넣습니다 :
,210- (IBAction)handleOpenFBDialog:(id)sender
는 이것을의 ViewController B 및 호출 초기화 기능 :의 ViewController B 을 보여 가정
[self.LoginDialogViewController checkLoginRequired:@"tst"];
하지만 모두가 않습니다 검은 화면을 보여줍니다.
감사 : '의 UIViewController *' 재산권 'requestPremision'유형의 개체에없는 속성 'apiKey에' 'UIViewController *'유형의 객체에서 찾을 수 없습니다. 질문을 업데이트했습니다. – user63898
죄송합니다. 예제에서는 viewController를 TAFBLoginDialogViewController가 아닌 UIViewController로 선언 했으므로 속성이 존재하지 않는다는 오류가 발생합니다. 예를 업데이트했습니다. – Brandon
당신은 남자입니다! 감사! – user63898