में कोई कीबोर्ड नहीं है मेरे पास एक पुराना एक्सकोड प्रोजेक्ट है जो आईओएस 6 और उच्चतर के लिए लक्षित है। मैं हाल ही में यह Xcode 6 में खोल दिया और iOS 8. के लिए iPhone 6 सिम्युलेटर में भाग गया जब मैं इस कार्रवाई की कोशिश कीUIAlertView बनाम UIAlertController - आईओएस 8
UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Enter Folder Name"
message:@"Keep it short and sweet"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
dialog.alertViewStyle = UIAlertViewStylePlainTextInput;
dialog.tag = 400;
[dialog show];
मैं एक पॉप-अप विंडो मिलता है लेकिन जब मैं पाठ क्षेत्र पर क्लिक करें, कोई कुंजीपटल ऊपर आता है । मैंने googled और पढ़ा कि मुझे इसके बजाय UIAlertController का उपयोग करने की जरूरत है। चूंकि मुझे आईओएस 6, 7 संस्करणों का समर्थन करने की आवश्यकता है, इसलिए मैंने अपना कोड इस तरह बदल दिया।
if ([UIAlertController class])
{
// use UIAlertController
UIAlertController *alert= [UIAlertController
alertControllerWithTitle:@"Enter Folder Name"
message:@"Keep it short and sweet"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action){
//Do Some action here
UITextField *textField = alert.textFields[0];
NSLog(@"text was %@", textField.text);
}];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
NSLog(@"cancel btn");
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:ok];
[alert addAction:cancel];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"folder name";
textField.keyboardType = UIKeyboardTypeDefault;
}];
[self presentViewController:alert animated:YES completion:nil];
}
else
{
// use UIAlertView
UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Enter Folder Name"
message:@"Keep it short and sweet"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
dialog.alertViewStyle = UIAlertViewStylePlainTextInput;
dialog.tag = 400;
[dialog show];
}
फिर अगर मैं एक ही कार्रवाई कोई कुंजीपटल प्रदर्शित किया जाता है की कोशिश करो।
क्या यह एक्सकोड 6 सिम्युलेटर में एक बग है या मैं कुछ गलत कर रहा हूं?
दबाने "कमांड" + "K" का प्रयास करें, हो सकता है आईओएस हार्डवेयर कीबोर्ड पता लगा रहा है तो यह नहीं है कीबोर्ड दिखा रहा है –
सिम्युलेटर मेनू विकल्प में हार्डवेयर -> कीबोर्ड -> सॉफ़्टवेयर कीबोर्ड टॉगल करें – yazh