1
Objective-Cの新機能です。私は特定のビューのためにポートレートモードを修正したい。風景モードを使用している他のビューとビューを終了するときにポートレートモードを戻す。しかし、まだ特定のビューで横長モード。Objective-Cの特定のビューのポートレートモードを修正する方法はありますか?
- (NSUInteger) supportedInterfaceOrientations {
// Return a bitmask of supported orientations. If you need more,
// use bitwise or (see the commented return).
return UIInterfaceOrientationMaskPortrait;
// return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
// Return the orientation you'd prefer - this is what it launches to. The
// user can still rotate. You don't have to implement this method, in which
// case it launches in the current orientation
return UIInterfaceOrientationPortrait; }
特定のビューにコードを追加します。
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"];
そして、このコードはこのメソッドを入力します。
これを修正するにはどうすればよいですか?
ありがとうございました!あなたのコードそれは私が欲しいものです。さらに私はこの問題を解決しました。つまり、私はこのラインの風景モードをコード化しています - > [[UIDevice currentDevice] setvalue:~~]だから、私はコードの風景 - >肖像画を変更します。 –
私はあなたを助けてとてもうれしいです。 –