पहले JSSAlertView का इस्तेमाल करें, अपने वेब दृश्य के साथ एक दृश्य नियंत्रक बनाने के लिए, यह MyWebViewController
फोन करते हैं।
तो फिर तुम यह पेश कर सकते हैं या तो एक पूर्ण स्क्रीन नियंत्रक के रूप में:
MyWebViewController* alertController = [[MyWebViewController alloc] init];
alertController.view.backgroundColor = [UIColor.lightGrayColor colorWithAlphaComponent:0.2];
alertController.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self presentViewController:alertController animated:YES completion:nil];
यह एक पूर्ण स्क्रीन नियंत्रक हालांकि है। आपको अपनी सामग्री के लिए केंद्र में एक दृश्य बनाना होगा, उस दृश्य के लिए एक सीमा जोड़ें और सब कुछ semitransparent के आसपास रखें।
तुम भी एक पॉपओवर उपयोग कर सकते हैं:
UIView *sourceView = self.view;
MyWebViewController* alertController = [[MyWebViewController alloc] init];
alertController.modalPresentationStyle = UIModalPresentationPopover;
alertController.preferredContentSize = CGRectInset(self.view.bounds, 20, 100).size;
alertController.popoverPresentationController.canOverlapSourceViewRect = YES;
alertController.popoverPresentationController.sourceView = sourceView;
alertController.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMidX(sourceView.bounds), CGRectGetMidY(sourceView.bounds), 0, 0);
alertController.popoverPresentationController.permittedArrowDirections = 0;
alertController.popoverPresentationController.delegate = self;
[self presentViewController:alertController animated:YES completion:nil];
प्रतिनिधि भी लागू करने के लिए है:
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection {
return UIModalPresentationNone;
}
स्रोत दृश्य आमतौर पर बटन जो पॉपओवर खोलता है, लेकिन मैं जनक दृश्य का उपयोग कर रहा यह सुनिश्चित करने के लिए कि पॉपओवर केंद्रित है।
आपको उन बटनों को भी जोड़ना होगा जो स्वचालित रूप से UIAlertView
द्वारा जोड़े गए हैं लेकिन यह छोटा होना चाहिए।
कस्टम नियंत्रक बनाएं और इसे प्रस्तुत करें। 'UIAlertView' का उपयोग न करें (आप वास्तव में कस्टम दृश्य जोड़ने के लिए' UIAlertView' हैकिंग कर रहे हैं)। – Sulthan
कस्टम व्यू का उपयोग करें, –
उल्लेख नहीं है कि 'UIAlertView' को' UIAlertController' – Losiowaty