我很困惑:
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) 我有一个问题,因为我的应用程序崩溃,当我试图获得位置用户并在我的.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
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)
我该怎么办谢谢
我在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) 我正在使用这些方法和这些变量
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 之间的距离
感谢任何帮助