ViewController.view未在iPhone6 / iPhone 6 Plus中全屏显示

时间:2014-10-15 10:29:18

标签: ios8 autolayout ios7.1 xcode6.0.1

我将Pickerview显示为UIViewcontroller的子视图,并将UIViewcontroller.view添加到我的窗口子视图中。能不能让我知道我在这里做错了什么。enter image description here

以下是另一个View Controller打开UIViewController.view的代码:

self.customActionSheet = [[PickerViewController alloc] init];
[[[[UIApplication sharedApplication] delegate] window] addSubview:self.customActionSheet.view];
[self.customActionSheet viewWillAppear:NO];

以下是PickerViewController中的UIViewController.view中的Slide代码:

//set initial location at bottom of view
[self.view setBounds:CGRectMake(0, [[UIScreen mainScreen] bounds].origin.y, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
[self.actionSheetView setBounds:CGRectMake(0, [[UIScreen mainScreen] bounds].origin.y, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
CGRect frame = self.actionSheetView.bounds;
frame.origin = CGPointMake(0.0, self.view.bounds.size.height);
self.actionSheetView.frame = frame;
self.actionSheetView.hidden = YES;
[self.view addSubview:self.actionSheetView];

// Set Picker View
self.pickerView.showsSelectionIndicator = YES;
self.pickerView.dataSource = self;
self.pickerView.delegate = self;
self.pickerView.hidden = YES;


// Select Language ID according to Languages assin to the exist customer
NSArray *alllanguages = [session.database getlanguageidForPickerView:customerID];
for(NSUInteger count=0; count<[alllanguages count]; count++)    {
    NSString *value = (NSString *) [[alllanguages valueForKey:@"language_ID"]objectAtIndex:count];
    languageIDs = session.getLanguageID;
    if([languageIDs isEqualToString:value]) {
        NSUInteger newcount = count;
        [pickerView selectRow:newcount inComponent:0 animated:YES];
    }
}

UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 46)];
NSArray *fontDetails = [session.database getFontDetails:customerID];
NSString *themeColor = (NSString *) [[fontDetails valueForKey:@"themeColor"]objectAtIndex:0];
pickerToolbar.barStyle = UIBarStyleDefault;
[pickerToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed)];

[session LoadCustomerConfigDetails];
[doneBtn setTintColor:[session makeColorFromHexString:session.customerConfidModall.header_Font_Color alpha:1.0]];
[barItems addObject:doneBtn];

UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonPressed)];
[cancelBtn setTintColor:[session makeColorFromHexString:session.customerConfidModall.header_Font_Color alpha:1.0]];
[barItems addObject:cancelBtn];
[pickerToolbar setItems:barItems animated:YES];

[self.actionSheetView addSubview:self.pickerView];
[self.actionSheetView addSubview:pickerToolbar];
self.view.alpha = 1.0f;


if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
    // Load resources for iOS 6.1 or earlier
    [UIView animateWithDuration:0.4
                     animations:^{

                         pickerToolbar.barTintColor = [session makeColorFromHexString:themeColor alpha:1.0];
                         pickerToolbar.layer.borderColor = [[session makeColorFromHexString:themeColor alpha:1.0] CGColor];
                         pickerToolbar.tintColor = [session makeColorFromHexString:themeColor alpha:1.0];
                         self.actionSheetView.hidden = NO;
                         self.pickerView.hidden = NO;
                         CGRect newframe = self.actionSheetView.frame;
                         newframe.origin.y =
                         newframe.origin.y - self.actionSheetView.frame.size.height;
                         self.actionSheetView.frame = newframe;
                     }
                     completion:^(BOOL finished) {}];

} else {

    [UIView animateWithDuration:0.4
                          delay:0.1
         usingSpringWithDamping:0.75
          initialSpringVelocity:0
                        options:0
                     animations:^{

                         pickerToolbar.barTintColor = [session makeColorFromHexString:themeColor alpha:1.0];
                         pickerToolbar.layer.borderColor = [[session makeColorFromHexString:themeColor alpha:1.0] CGColor];
                         pickerToolbar.tintColor = [session makeColorFromHexString:themeColor alpha:1.0];
                         self.actionSheetView.hidden = NO;
                         self.pickerView.hidden = NO;
                         CGRect newframe = self.actionSheetView.frame;
                         newframe.origin.y = newframe.origin.y - self.actionSheetView.frame.size.height;
                         self.actionSheetView.frame = newframe;
                     }
                     completion:^(BOOL finished) {}];

0 个答案:

没有答案