在UYLModalViewController中更改View的大小

时间:2012-01-15 13:57:56

标签: objective-c ios ipad xcode4 orientation

我创建了一个模态视图控制器。在我创建TableView和TextField

Modal View

在垂直位置一切都好! Verticlal

但在水平方面,a可以看到所有这些Vertical

如何为其调整视图大小?

这里是调用ModalView的代码

-(IBAction)buttonTapped:(id)sender{
    UYLModalViewController *modalVC = [[UYLModalViewController   alloc] initWithNibName:@"UYLModalViewController" bundle:nil];
    modalVC.delegate = self;

    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:modalVC];
    if (modalViewShowType==1)
    {
        nc.modalPresentationStyle = UIModalPresentationFullScreen;
         [self presentModalViewController:nc animated:YES];
    }
    else{

        nc.modalPresentationStyle = UIModalPresentationFormSheet;
        nc.view.bounds = CGRectMake(0, 0, 320, 480);
        [self presentModalViewController:nc animated:YES];
        //nc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;  
        //nc.view.frame = CGRectMake(0, 0, 320, 480);//it's important to do this after presentModalViewController
        //nc.view.center = self.view.center;
    }



    [modalVC release];
    [nc release];

}

这里是modalView控制器的声明

@protocol UYLModalViewControllerDelegate

-(void) buttonDonePassed :(NSArray *) variables;


@end

@interface UYLModalViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate>
{ 

    id<UYLModalViewControllerDelegate> delegate;
    //id<UITextFieldDelegate> textdelegate;
   // id<UITextField> txt;
    IBOutlet UITableView *tblView;
    IBOutlet UITextField *textField;

    NSMutableArray *cellsArray;
    BOOL isAddedNewRow;
    //UITextField *textField;



}
- (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier :(NSInteger *)cellRow;
//-(void) clickToTextField:(id)sender;
@property (nonatomic, assign) id<UYLModalViewControllerDelegate>    delegate;
@property (nonatomic, retain) IBOutlet UITableView *tblView;
@property (retain, nonatomic) IBOutlet UITextField *textField;


@end

正如我在调试模式下看到的那样,当设备处于水平位置时,它不会转到tableview委托方法=(

1 个答案:

答案 0 :(得分:0)

1)在哪里定义了方法:

-(IBAction)buttonTapped:(id)sender;

我认为在

上呈现modal一个viewController是个问题

UISplitViewController ...尝试将其呈现在其他ViewController上进行测试

2)如果你没有正确使用它,UISplitViewController会产生一些问题

示例:尝试addSubView其视图(你不能推它)

3)使用auoresizeMask的UYLModalViewController视图验证