Search code examples
objective-ciosipadxcode4orientation

Change size of View in UYLModalViewController


I create an modal View controller. And In I crate TableView And TextField

Modal View

In vertical position all ok! Verticlal

But in horizontal a can see all of this Vertical

How can I resize my view for it?

Here the code of call 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];

}

and here the declaration of controller for 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

As I can see in debug mode when the device in horizontal position it doesn't go to the tableview delegate methods =(


Solution

  • 1) Where is defined the methode :

    -(IBAction)buttonTapped:(id)sender;
    

    I think that there is a problem with presenting modal a viewController over an

    UISplitViewController...try to present it over an other ViewController to test

    2) the UISplitViewController can create some problems if you use it not correctly

    example: try to addSubView its view ( you can't push it )

    3) Verify with the auoresizeMask of UYLModalViewController view