小编Fab*_*bio的帖子

如何在ios6中播放视频

我很困惑:

MPMoviePlayerViewController和MPMoviePlayerController

在ios6中本地播放视频的最佳方式是什么?

这是我的代码

NSURL * url = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: @ "17" OfType: @ "mov"]];

     MoviePlayer = [[MPMoviePlayerViewController alloc]
                     initWithContentURL: url];
     [self presentMoviePlayerViewControllerAnimated: MoviePlayer];
     [moviePlayer.moviePlayer play];
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @ selector (moviePlayerPlaybackStateChanged :) name: MPMoviePlayerPlaybackStateDidChangeNotification object: nil];
}


-(void)moviePlayerPlaybackStateChanged:(NSNotification *)notification {


}
Run Code Online (Sandbox Code Playgroud)

video xcode ios ios6

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

CLLocationManager致命错误:在展开可选值Swift时意外发现nil

我有一个问题,因为我的应用程序崩溃,当我试图获得位置用户并在我的.plist中获得我的代码的权限.

import UIKit
import MapKit
import CoreLocation

class mapClass : UIViewController,MKMapViewDelegate,CLLocationManagerDelegate{

    var location4 = CLLocation()
    var lm  = CLLocationManager ()

    @IBOutlet  var propMapa: MKMapView!

    lm.delegate=self
    lm.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
    lm.distanceFilter = kCLDistanceFilterNone
    lm.startUpdatingLocation()

    println("\(lm.location)") <---- nil

   location4 = lm.location <---- crash

}
Run Code Online (Sandbox Code Playgroud)

日志:致命错误:在展开Optional值时意外发现nil

mkmapview cllocationmanager ios swift

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

如何从NSMutableArray动态创建uilabel?

NSMutableArray *items //包含15个项目

我需要把一个标签从另一个下来我尝试这样的东西但不起作用

int count=20;

for(int i = 0; i < [items count]; i++){
        UILabel *label =  [[UILabel alloc] initWithFrame: CGRectMake(0,0,0,count)];
        label.text = @"text"; //etc...
        count+=20;

        [_scroll addSubview:label];

    }
Run Code Online (Sandbox Code Playgroud)

我该怎么办谢谢

objective-c uilabel ios

2
推荐指数
1
解决办法
1766
查看次数

我怎么能在viewDidLoad中做UIView animateWithDuration?IOS 7

我在viewDidAppear中尝试这个,但我有一秒钟的延迟=(我能做什么?在viewDidLoad中工作?

-(void)viewDidAppear:(BOOL)animated{


            fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
            fullRotation.fromValue = [NSNumber numberWithFloat:0];
            fullRotation.toValue = [NSNumber numberWithFloat:((720*M_PI)/360)];
            fullRotation.duration = 5;
            //  fullRotation.repeatCount = 1e10f;
            [_propImaCirculoCompleto.layer addAnimation:fullRotation forKey:@"360"];


}
Run Code Online (Sandbox Code Playgroud)

xcode animation objective-c ios

2
推荐指数
1
解决办法
1945
查看次数

找到两个CG点之间的距离?

我正在使用这些方法和这些变量

CGPoint touchBegan;
CGPoint touchEnd;

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{

}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

}
Run Code Online (Sandbox Code Playgroud)

但我无法获得两点之间的距离。例如,用手指画一条线并获取 CGPoint touchBegan 和 CGPoint touchEnd 之间的距离

感谢任何帮助

objective-c touch uitouch drawrect

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