2011-10-12 24 views
5

Tôi hiện đang gặp một số sự cố với chế độ xem và popovers phương thức. Nó có thể là cùng một vấn đề, nhưng tôi không chắc chắn.Không thể thay đổi kiểu trình bày và chuyển đổi của chế độ xem phương thức trong Xcode (iPad)

Sự cố tôi gặp phải với chế độ xem phương thức là tôi không thể thay đổi hình động hoặc kiểu chuyển đổi. Ví dụ: tôi viết

self.modalPresentationStyle = UIModalPresentationPageSheet; 
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:IpModal animated:YES]; 

nhưng chế độ xem phương thức vẫn xuất hiện toàn màn hình với kiểu chuyển đổi ban đầu.

Ngoài ra, sự cố tôi gặp phải với cửa sổ bật lên khá giống nhau. Mặc dù tôi gọi hàm dismissPopover: animated: method với "NO" làm tham số, quá trình chuyển đổi vẫn hoạt hình.

Xin cảm ơn trước.

Trả lời

1

Có lẽ bạn có thể thử sử dụng một trong hai phương pháp này để trình bày bộ điều khiển bật lên, tùy thuộc vào nơi bạn muốn nó xuất hiện, thay vì presentModalViewController:animated:.

– presentPopoverFromRect:inView:permittedArrowDirections:animated: 
– presentPopoverFromBarButtonItem:permittedArrowDirections:animated: 
24

modalPresentationStylemodalTransitionStyle áp dụng đối với bộ điều khiển điểm cho rằng là để được trình bày modally, chứ không phải điều khiển làm trình bày.

Mã của bạn nên

IpModal.modalPresentationStyle = UIModalPresentationPageSheet; 
IpModal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:IpModal animated:YES]; 
+0

+1 Tính năng này cũng hoạt động khi đặt ở chế độ xem điều khiển đích cho kiểu để loại bỏ trở lại bằng cách đặt chúng thành chính nó. Ví dụ như trường hợp xem trước bộ điều khiển xem qua cảm ứng lực, việc cài đặt chuyển tiếp loại bỏ có vẻ linh hoạt bằng cách thực hiện ở phía đích. – haxpor

4

Tôi đã làm điều này trong segue tùy chỉnh.

UIViewController* src = self.sourceViewController; 
UIViewController* dst = self.destinationViewController; 

src.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal; 
dst.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal; 
[src presentModalViewController:dst animated:YES]; 
2
#import yourViewController.m //already present 
#import destinationVieController.m //to be added by programmer 

//custom function to call destination controller 

-(void)callDestinationViewController{ 

    destinationViewController *dest = [[destinationViewController alloc] initWithNibName:@"destinationViewController" bundle:nil]; 

    dest.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:dest animated:YES]; 

    } 

//custom function can be called on event fire or action call 

Hope this helps!

Các vấn đề liên quan