0
我試圖通過其在線文檔實現條帶到iOS應用程序。目前爲止的一切都很好,現在將paymentView推到我的導航控制器堆棧上,我得到了一個完全破碎的屏幕。認爲這是條紋視圖的問題,但是當我沒有登錄時(請參閱下面的代碼 - 沒有給出識別令牌),而是登錄屏幕被推送,它也是完全黑色的。它不能成爲該視圖的問題,因爲如果我在這個視圖之前從其他視圖推入登錄視圖,它會加載得很好。ios推送到導航控制器結束在黑色屏幕
那麼爲什麼通過下面的buyButtonAction推送視圖給我黑色/搞砸屏幕? 我已經在這上了幾個小時..沒有什麼似乎工作。
一峯:
the important code part:
@interface PaymentViewController()
@end
@implementation PaymentViewController
@synthesize stripeCard = _stripeCard;
@synthesize stripeView;
@synthesize passedProductId;
- (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.
self.stripeView = [[STPView alloc] initWithFrame:CGRectMake(15,20,290,55)
andKey:@"pk_test_45mqixOu8N9S4lQ6cdn1OXBD"];
self.stripeView.delegate = self;
[self.view addSubview:self.stripeView];
}
和呼叫:
-(void)buyButtonAction:(id)sender
{
tokenClass *tokenObject = [tokenClass getInstance];
NSLog(@"%@", tokenObject.token);
if (tokenObject.token == nil) {
LoginController *loginController = [[LoginController alloc] init];
[self.navigationController pushViewController:loginController animated:YES];
} else {
NSLog(@"%@", tokenObject.token);
CGPoint hitPoint = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *hitIndex = [self.tableView indexPathForRowAtPoint:hitPoint];
PaymentViewController *payView = [[PaymentViewController alloc] init];
payView.passedProductId = [[self.productData valueForKey:@"id"] objectAtIndex:hitIndex.row];
NSLog(@"passing %@", payView.passedProductId);
// push payment view
payView.navigationItem.title = @"One-Click-Payment";
[self.navigationController pushViewController:payView animated:YES];
}
}
感謝的是放倒編輯字段,但設計仍然從根本上被破壞(黑色背景 - 看起來好像視圖沒有被加載,然後編輯區域被全部寫在彼此之上。) – mgreschke
你在'PaymentViewController'中嘗試過'self.view.backgroundColor = [UIColor whiteColor]'嗎? – jbouaziz
好吧,抱歉,我意識到這確實是一片空白的景象。因此調整背景顏色工作,謝謝! 在閱讀條紋文檔後,我的理解是,它是最終用戶的完整視圖,因此對質量不好有所懷疑。謝謝! – mgreschke