आप कस्टम UIStoryboardSegue के साथ एक सामान्य रूप से प्रस्तुत दृश्य का आकार बदल सकते हैं। स्टोरीबोर्ड में, मोडल के बजाय सेग्यू को कस्टम पर सेट करें। सेगु क्लास में, इसे अपने यूआईएसटीरीबोर्डसेग ओवरराइड का नाम दें।
UIStoryboardSegue को ओवरराइड करने के लिए, आपको अपनी .h फ़ाइल में कुछ भी आवश्यकता नहीं होगी। यह कुछ इस तरह के रूप में दिखाई देगा:
MyStoryboardSegue.h:
#import <UIKit/UIKit.h>
@interface MyStoryboardSegue : UIStoryboardSegue
@end
MyStoryboardSegue.m में, कोड होगा:
#import "MyStoryboardSegue.h"
@implementation MyStoryboardSegue
- (void)perform
{
id sourceController = self.sourceViewController;
id destinationController = self.destinationViewController;
UIView *destinationView = [destinationController view];
CGFloat x, y, w, h;
[destinationController setModalPresentationStyle:UIModalPresentationFormSheet];
[destinationController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[sourceController presentViewController:destinationController animated:YES completion:nil];
/*
You have to present the view first, and then resize it. That's because,
as far as I can tell, when you present your view modally, a new view is created
that covers the screen in a black semi-transparent mask to give the shadow effect,
and a container view is placed in the middle of this view that in turn holds the
view you are presenting. Your view automatically resizes to the size of this
container view, so that's the view you need to resize to make your view controller
appear the size you desire. You must present your modal view first
because until you do, the container view doesn't exist. The following code
resizes the container view (which is now your modal view's superview) and then
resets the position of the container view to the center of the source view that
is presenting the modal view so everything looks nice and centered.
*/
x = destinationView.superview.frame.origin.x;
y = destinationView.superview.frame.origin.y;
w = 400; // Your desired modal view width
h = 400; // Your desired modal view height
destinationView.superview.frame = CGRectMake(x, y, w, h);
destinationView.superview.center = [[sourceController view] center];
}
@end
ध्यान दें, आप लगभग हमेशा एक modalViewController ले जाना चाहते हैं पूरी स्क्रीन ऐसा इसलिए है क्योंकि modalViewController दिखाई देने के बाद modalViewController के अंतर्गत "नियंत्रक" दृश्य नियंत्रक हटा दिया जाता है। इस प्रकार, यदि आप अन्य दृश्य नियंत्रक को "नीचे" दिखाए जाने के इरादे से अपने मोडल व्यू कंट्रोलर के साथ स्क्रीन के आधे हिस्से को कवर करने का प्रयास कर रहे थे, तो यह काम नहीं करेगा। यह सफेद दिखाएगा। मैं पैरेंट व्यू के सबव्यूव के रूप में एक दृश्य जोड़कर इस कार्यक्षमता को पूरा करता हूं। – bearMountain
आपकी टिप्पणी ढांचे के व्यवहार के संदर्भ में सही हो सकती है, लेकिन निश्चित रूप से आप जो चाहते हैं वह आपके ऐप के यूएक्स द्वारा निर्धारित किया जाना चाहिए और उपयोगकर्ता के लिए सबसे अच्छी समझ है, यूआई ढांचे के अंतर्निहित अंतःक्रियाओं को नहीं। आपका यूएक्स एक कस्टम संवाद के अंदर अपने मोडल यूआई पेश करने का निर्देश दे सकता है, इस मामले में आपको अभी भी संवाद के पीछे सामग्री को देखना होगा। एक कस्टम segue और unind segue आसानी से आवश्यकतानुसार संवाद उप-दृश्य (अंधेरा, संवाद सामग्री) को जोड़कर/हटाकर पिछले नियंत्रक के दृश्य को हटाए बिना इसका ख्याल रख सकता है। – Marchy
http: // stackoverflow पर एक कार्य समाधान है।कॉम/प्रश्न/25250510/सेट-साइज-ऑफ-आईफोन-व्यू-कंट्रोलर/25251507 # 25251507 –