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");
}
}];
结果
请让我知道如果我能在我的代码一些变化解决这个问题。