Tag: ios5

PageViewController委托函数被调用两次

我正在使用UIPageViewController来为我的应用程序进行产品导览。 我跟着这个链接http://www.appcoda.com/uipageviewcontroller-tutorial-intro/ 我正在做的是简单的任务,改变我的“根VC”滑动的背景颜色,基于我得到的索引值,但由于委托函数被调用两次,我的指数值是不正确的,因此,我不是能够得到它的权利,下面是我的代码 #import "APPViewController.h" #import "APPChildViewController.h" @interface APPViewController () @end @implementation APPViewController – (void)viewDidLoad { [super viewDidLoad]; self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; self.pageController.dataSource = self; [[self.pageController view] setFrame:CGRectMake(0, 0, 320, 500)]; APPChildViewController *initialViewController = [self viewControllerAtIndex:0]; NSArray *viewControllers = [NSArray arrayWithObject:initialViewController]; [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; [self addChildViewController:self.pageController]; [[self view] addSubview:[self.pageController view]]; […]

iPhone:我们如何以编程方式更改屏幕的亮度?

如何使用iPhone SDK以编程方式更改屏幕亮度? 请告诉我。 谢谢!

如何导入仅适用于iOS 6的社交框架?

如何导入仅适用于iOS 6的社交框架? 我想要禁用其他iOS版本的社交框架。 目前我正在尝试这个,我也试图改变框架可选,但不能在iOS 5.1模拟器上运行。 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) { #import <Social/Social.h> } 请告诉如何检查和运行iOS 5和iOS 6.谢谢。

如何通过隐藏SLComposeViewController * tweetSheettweet实例在Twitter上发布

我的应用需要支持iOS 5。 我有我的自定义用户界面,用户可以inputtweet消息,当他按下后button,它应该张贴消息Twitter。 我已经编写了通过SLComposeViewController * tweetSheet实例发布的代码,但在这种情况下,我不能直接按tweetSheet提供的发送button, [self presentViewController:tweetSheet animated:YES completion:nil]; 是否有可能绕过这个演示文稿,并设置文本消息,并张贴到Twitter通过我的自定义用户界面有postbutton? if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { switch(result) { // This means the user cancelled without sending the Tweet case SLComposeViewControllerResultCancelled: NSLog(@"Tweet message was cancelled"); break; // This means the user hit 'Send' case SLComposeViewControllerResultDone: NSLog(@"Done pressed […]

从xcode storyboard中可视化地修改UIToolbar

我正在使用XCode 4和故事板创build的应用程序,但是我无法直观地修改UIToolbar。 我试图修改一个UIToolView里面的UITableViewController – 但是我必须把UIToolbar放在正确的层次结构,以便能够直观地修改它。 我已经尝试将其放置在视图控制器区域,但没有显示出来。 有一次,我能够使它出现在下面,因为它是自己的对象,但是我不能重新创build它。 一旦我能够看起来像这样

UITableView:处理混合单元格表格中的单元格select查看静态和dynamic单元格

我想在组合的表格视图中混合dynamic和静态单元格:我想在静态单元格的顶部有两个部分,后面跟着一部分dynamic单元格 (请参阅下面的屏幕截图)。 我已经将表格视图内容设置为静态单元格 。 编辑 基于AppleFreak的build议,我改变了我的代码如下: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell; if (indexPath.section <= 1) { // section <= 1 indicates static cells cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; } else { // section > 1 indicates dynamic cells CellIdentifier = [NSString stringWithFormat:@"section%idynamic",indexPath.section]; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier […]

当主页button被按下时检测iOS

我有几个iOS应用程序都使用相同的端口来侦听networking信标。 在主视图中,我使用viewWillDisappear在另一个视图打开时closures端口,这非常有效。 然后我注意到,如果我从主视图控制器按下主页button,而不打开另一个视图closures端口,那么端口保持打开,我的其他应用程序不能再监听该端口。 然后,我尝试使用viewWillUnload,但似乎并没有被调用时,我按Home键。 -(void)viewWillUnload { //[super viewWillUnload]; NSLog(@"View will unload"); [udpSocket close]; udpSocket = nil; } 视图将不会显示在控制台,这导致我相信这个方法永远不会被调用。 有没有办法检测何时按下主页button,所以我可以closures我的端口?

我可以使用iCloud来同步NSUserDefaults plist文件吗?

我想知道是否有可能使用iCloud在设备之间同步应用程序的首选项文件。 我所说的首选项文件是NSUserDafults创build的com.domain.appname.plist文件,用于存储应用程序的首选项。 我想要让我的应用程序的首选项文件在两个不同的设备(例如iPad和iPhone)之间同步的选项。 这是一个可以接受的使用iCloud同步吗? 或者,我是否需要将plist文件转换为不同types的文档,将其存储在云端,然后将其转换回应用程序的首选项文件? 谢谢!

升级到Xcode 4.5后,iOS 5 SDK消失了

我将Xcode升级到版本4.5。 现在所有的偏好设置都被重置为出厂设置 – 编辑器字体,颜色等 – 但这不是我最关心的问题。 看来我所瞄准的iOS SDK 5.1现在不见了。 在项目的构build设置中,我只能select“最新iOS(iOS 6.0)”和“iOS 6.0”之间的基础SDK。 是否有可能恢复以前安装的SDK?

无法在iOS5中从CIImage创buildUIImage

我正在使用AVFoundation框架。 在我的示例缓冲区委托我有以下代码: -(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection{ CVPixelBufferRef pb = CMSampleBufferGetImageBuffer(sampleBuffer); CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pb]; self.imageView.image = [UIImage imageWithCIImage:ciImage]; } 我能够使用CIImage运行人脸检测器等,但它不显示在UIImageView … imageView保持白色。 关于这个问题的任何想法? 我正在使用以下来设置我的会话: self.session = [[AVCaptureSession alloc] init]; self.session.sessionPreset = AVCaptureSessionPreset640x480; self.videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; self.videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil]; self.frameOutput = [[AVCaptureVideoDataOutput alloc] init]; self.frameOutput.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];