मेरे पास एक यूआईपीकर व्यू है और इसे आईपैड में यूआईएक्शनशीट के अंदर दिखाने की ज़रूरत है (यह आईपैड में नहीं, आईफोन में बहुत सीधी काम करता है)।आईपैड में UIActionSheet के अंदर UIPickerView जोड़ना
- (IBAction) buttonPressed:(id)sender
{
NSLog(@"I am pressed");
UIPickerView* picker = [[UIPickerView alloc] initWithFrame:CGRectMake(100,200,500,500)];
picker.delegate = self;
picker.dataSource = self;
picker.showsSelectionIndicator = YES;
[self.view addSubview:picker];
}
// PickerView प्रतिनिधि और डेटा स्रोत कार्य::
// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return 5;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return @"One";
}
लेकिन जब परिवर्तन ऊपर
मैं पर मैं निम्नलिखित कोड निष्पादित जब मैं देखें क्लिक करें पर एक बटन है एक एक्शनशीट के अंदर पिकर व्यू जोड़ने के लिए कोड, यह केवल एक्शनशीट का शीर्षलेख दिखाता है लेकिन इसके अंदर पिकर व्यू के बिना! इस प्रकार
संशोधित कोड:
- (IBAction) buttonPressed:(id)sender
{
NSLog(@"I am pressed");
UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"My PickerView"
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
UIPickerView* picker = [[UIPickerView alloc] initWithFrame:CGRectMake(100,200,500,500)];
picker.delegate = self;
picker.dataSource = self;
picker.showsSelectionIndicator = YES;
[actionSheet addSubview:picker];
[actionSheet showFromRect:CGRectMake(0, 0, 320, 469) inView:self.view animated:NO];
}
जब मैंने पिकर व्यू इनिटलाइन को 'UIPickerView * picker = [[UIPickerView alloc] initWithFrame में बदल दिया: CGRectMake (0,0,320,469)]; 'अब मैं एक्शनशीट के अंदर पिकर व्यू का बहुत छोटा हिस्सा देख सकता हूं लेकिन एक्शनशीट दिखाया गया है एक बहुत छोटे वर्ग के रूप में, मैं इसे बड़ा कैसे बना सकता हूं, मैं अपनी चौड़ाई और ऊंचाई को बदलने की कोशिश कर रहा हूं लेकिन काम नहीं कर रहा है! –
यह देखने के लिए कि क्या आकार बदलता है, रद्द करने के लिए कुछ NSString को रद्द करें बटन को सेट करने का प्रयास करें। –
मैं बेकार हूं, मैं इसके बजाय 'UITableViewController' के साथ' UIPopoverController' का उपयोग करूंगा! .. फिर भी धन्यवाद! –