小编jak*_*ife的帖子

更改NSMutableArray中所有对象的属性

我有NSMutableArray9个对象.这些对象有很多属性,如questionName,questionWhatRow等.

我希望能够为其中的所有对象更改其中一个属性NSMutableArray.

这是我的NSMutableArray类.

-(id) init
{
    self = [super init];

    if (self)
    {
        self.questionsArray = [[NSMutableArray alloc] init];

        Question *newQuestion = [[Question alloc] init];
        newQuestion.questionName = @"What is the name of the girl who has to fetch water for her family every day?";
        newQuestion.questionRowName = @"Question 1";
        newQuestion.questionAnswer = @"Nya";
        newQuestion.questionHint = @"Maybe if you read the book you would know";
        newQuestion.questionWhatRow = @"Nya";
        newQuestion.questionCompleteOrNot = @"No";
        newQuestion.pointForQuestion = 1; …
Run Code Online (Sandbox Code Playgroud)

properties objective-c nsstring nsmutablearray

7
推荐指数
1
解决办法
1237
查看次数

如何让我的MPMoviePlayerController在Landscape中播放?

我试图从youtube播放我的视频以横向模式播放.我左右关闭了横向以获得支持的设备方向,因为如果它已打开,则每个视图都可以进行横向显示.我正在为iOS 6构建这个.如何让我的视频在横向播放.

这是我的代码

#import "VideoTViewController.h"
#import "HCYoutubeParser.h"
#import <MediaPlayer/MediaPlayer.h>

@interface VideoTViewController ()

@end

@implementation VideoTViewController
@synthesize tLabel;

-(IBAction)playVideo
{

    NSDictionary *videos = [HCYoutubeParser h264videosWithYoutubeURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=zz_bJ58LfCg&feature=youtu.be"]];

    MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[videos objectForKey:@"medium"]]];

    [self presentViewController:mp animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

编辑:

我做了以下事情:

做了一堂新课

AboutNavViewController(它是UiNavigationController的子类)

#import "AboutNavViewController.h"

@interface AboutNavViewController ()

@end

@implementation AboutNavViewController


- (BOOL)shouldAutorotate {
    return NO;
}

- (BOOL)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}
@end
Run Code Online (Sandbox Code Playgroud)

在我的aboutviewcontroller(uiviewcontroller的子类)

#import "AboutViewController.h"
#import "AboutNavViewController.h"

@interface AboutViewController ()

@end

@implementation AboutViewController
@synthesize aLabel;

- (void)viewDidLoad
{
    [super …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c mpmovieplayercontroller ios6

3
推荐指数
1
解决办法
7919
查看次数