1
我在我的項目中使用了SDCAlertView的一個實例,在alert中添加一個UITextView來做一些facebook posts.It似乎不再適用於ios8。是否在iOS 8上正確添加子視圖到SDCAlertView?
我已經使用了下面的代碼。在iOS 7在iOS 8 GM
結果
SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:@"Post To Facebook"
message:@""
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Post", nil];
UITextView *textView = [[UITextView alloc] init];
[textView setTranslatesAutoresizingMaskIntoConstraints:NO];
[textView setEditable:YES];
textView.autocorrectionType = UITextAutocorrectionTypeNo;
[alert.contentView addSubview:textView];
[textView sdc_pinWidthToWidthOfView:alert.contentView offset:-5];
[textView sdc_pinHeight:120];
[textView sdc_horizontallyCenterInSuperview];
[textView sdc_verticallyCenterInSuperviewWithOffset:SDCAutoLayoutStandardSiblingDistance];
[alert showWithDismissHandler: ^(NSInteger buttonIndex) {
NSLog(@"Tapped button: %@", @(buttonIndex));
if (buttonIndex == 1) {
NSLog(@"POST %@", textView.text);
}
else {
NSLog(@"Cancelled");
}
}];
結果
請讓我知道如果我能在我的代碼一些變化解決這個問題。