Tag: ios5

适用于iOS5的FFmpeg

有没有人能够使用iOS5 sdk编译ffmpeg库? 我发现脚本使用4.3 sdk,但没有iOS5的。 我假设用sdk和armv7构build的库仍然可以兼容iOS 5。 这是我试图使用的命令: ./configure \ –cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ –as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ –sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk \ –extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system \ –target-os=darwin \ –arch=arm \ –cpu=cortex-a8 \ –extra-cflags='-arch armv7' \ –extra-ldflags='-arch armv7' \ –prefix=compiled/armv7 \ –enable-pic \ –enable-cross-compile \ –disable-armv5te \ –disable-ffmpeg \ –disable-ffplay \ –disable-ffserver \ –disable-ffprobe \ –disable-doc 我也尝试使用这样的脚本: #!/bin/tcsh -f if (! -d armv7) mkdir […]

如何使用自定义的UINavigationBar

我有UINavigationBar子类。 @interface MyNavigationBar : UINavigationBar 做了一些改变,现在希望我的应用程序NavigationController将使用它: _navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [_window addSubview:[_navigationController view]]; [self.window makeKeyAndVisible]; 我希望_ navigationController将MyNavigationBar 这可以怎么做? 谢谢。

检测用户是否触摸过屏幕

如何检测用户是否在过去的5秒钟内触摸过屏幕。 如果他们没有,我想调用我的方法来隐藏导航栏。 我find了一些答案,但无法弄清楚。 谢谢 .hhhh #import <UIKit/UIKit.h> #import "PageView.h" #import "SlideShowViewController.h" #import "PagesCollectionViewController.h" @interface PageFlipperAppDelegate : NSObject <UIApplicationDelegate> {} @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext; @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel; @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; – (void)saveContext; – (NSURL *)applicationDocumentsDirectory; @end @protocol MyKindOfWindowDelegate; @interface MyKindOfWindow : UIWindow […]

如何在iOS上使用OpenCV二进制化CGImage?

在我的iOS项目中,我有一个RGB的CGImage,我想二元化(转换为黑白)。 我想使用OpenCV来做到这一点,但我是OpenCV的新手。 我find了一本关于OpenCV的书,但它不适用于iPhone。 如何在iOS上使用OpenCV对这样的图像进行二进制化?

dismissViewControllerAnimated崩溃在ios5

由于循环引用,代码是否会崩溃? MenuController: UIViewController – (id)initWithNibName: {… TabsController *tabs = [[TabsController alloc] initWithNibName:@"TabsController" bundle:nil]; self.tab = tabs; …. } //button pressed: – (IBAction)showPrefFromMenu:(id)sender { // todo change delegate!? tab.tabDelegate = self; [self presentModalViewController:tab animated:YES]; //[tab release]; } // delegate method: -(void)myViewDismissed { …. NSLog(@"tab references: %d", [tab retainCount]) ; [self dismissModalViewControllerAnimated:YES];//crash … } 模态/子类: TabsController : […]

支持iOS 4.3到iOS 6.0

我已经有了支持ios 4.3到ios 5的基本代码。现在我也想支持ios 6.0。 目前的基本代码具有modal views ,硬编码的CGRect's ,并且每个视图的旋转是不同的。 所以我想知道我们是否可以用相同的基本代码支持ios 4.3到ios 6.0,只需调整一些更改,还是需要创build一个完整的新目标? 就像我们不能使用ios 6.0的自动布局,如果我想支持以前的版本,因为它会导致崩溃。

用户在运动中的距离

我正在编写一个应用程序,在用户走动时显示用户与固定点的距离(即每次用户移动时,显示用户到点的距离的标签都会更新)。 我使用了一个CLLocationManager,代码如下: – (void)viewDidLoad { locationManager=[[CLLocationManager alloc]init]; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; } -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocationDistance meters = [newLocation distanceFromLocation:fixedPoint]; self.distanceLabel.text = [[NSString alloc] initWithFormat:@"Distance: %.1f feet", meters*3.2808399]; } 应该显示从用户到点的距离的标签不会不断更新,更新时通常不会显示从用户到固定点的正确距离。 我想知道是否有更好的方法来尝试这样做,或者做核心位置框架的根本局限性,这是不可能的。 任何帮助将不胜感激。

Youtube在iOS5 – 完成button点击

在iOS5我想加载Youtube电影,我做到了: – (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame { NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height]; videoView = [[UIWebView alloc] initWithFrame:frame]; [videoView loadHTMLString:html baseURL:nil]; [self.view addSubview:videoView]; } 打电话: [self embedYouTube:@"http://www.youtube.com/v/PqtUSSdf8b4" frame:CGRectMake(0, 0, […]

屏幕亮度属性

目前我正在尝试创build一个应用程序来调整设备的亮度。 在iOS5中,mainScreen具有新的亮度属性,可让您设置屏幕亮度。 我使用下面的代码: [[UIScreen mainScreen] setBrightness:1.0]; 但是,这似乎只工作,直到设备被locking,并没有得到保存设置。 有什么我做错了吗?

将额外的行添加到由NSFetchedResultsControllerpipe理的UITableView

我在我的应用程序中使用UITableViewController作为表,并且我添加了一个NSFetchedResultsController来提供数据在表中显示(设置self为委托)。 不过,我想添加一个唯一的单元格作为表的最后一个单元格,与NSFetchedResultsController谓词产生的项目无关,我希望这个单元格始终位于表格的底部。 我已经尝试在表视图数据源中简单地添加1到这些方法: – (NSUInteger)numberOfSectionsInTableView:(UITableView *)sender { return [[self.fetchedResultsController sections] count] + 1; } – (NSUInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSUInteger)section { return [[[self.fetchedResultsController sections] objectAtIndex:section] numberOfObjects] + 1; } 然后捕捉这样的额外行的情况下(表只有1节): – (UITableViewCell *)tableView:(UITableView *)sender cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == [self.fetchedResultsController.fetchedObjects count]) { //Generate the last cell in table. } else { //Generate the rest of the […]