Tag: ios6

导航栏和表格视图之间的黑条出现在iOS 6上

自从我开始使用iOS 6之后,我似乎遇到了一个问题,在使用iOS 5时没有出现这个问题。起初,我认为这可能只是一个模拟器错误,但是从今天在iPhone 5上testing之后,我可以看到它不只是在模拟器中。 我以编程方式创build所有东西 – 我似乎更喜欢这样做(我认为这是因为我的HTML / CSS背景!) – 但是我还是比较新的Objective-C,我找不到完整的示例如何以编程方式设置导航控制器/表视图,所以我把它从我能find的信息的金块放在一起,因此,我可能会做一些根本性的错误。 但是,它在iOS 5上工作(并仍然有效)。 问题是我在导航栏和表格视图之间有一个黑条,但奇怪的是,如果我推视图并返回到原始视图,栏会消失,直到我完全重新启动才会重新出现该应用程序。 下面的图片是在启动(1)时的应用程序,我正在推动(2)中的一个视图,以及在我回到它之后的初始视图(3): 这就是我的代码: AppDelegate.m – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; RootViewController *rootController = [[RootViewController alloc] init]; self.window.rootViewController = rootController; self.navigationController = [[UINavigationController alloc] initWithRootViewController:rootController]; [self.window addSubview:navigationController.view]; [self.window makeKeyAndVisible]; NSLog(@"Window frame: %@", NSStringFromCGRect(self.window.frame)); return YES; } […]

EXE_BAD_ACCESS NSSearchPathForDirectoriesInDomains

我正在为另一家公司开发的iOS应用程序开发新版本,但现在是我的责任。 我一般都不太了解目标C和iOS开发的经验,但是我会尽我所能地尽力expression我的问题。 我有以下方法,我在改进过程中既没有改变也没有改变: – (Boolean)ShouldWeDownloadImage:(NSString*)p_ImageName { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *filePath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], p_ImageName]; NSFileManager *fileManager = [NSFileManager defaultManager]; if (!([fileManager fileExistsAtPath:filePath])) return true; NSDate *creationDate = [[fileManager attributesOfItemAtPath:filePath error:nil]objectForKey:NSFileCreationDate]; NSDate *currentDate = [NSDate date]; NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *dateComponents = [gregorian components:NSMonthCalendarUnit fromDate:creationDate toDate:currentDate options:0]; if […]

打开最新照片的相机胶卷

我已经知道如何打开相机胶卷: UIImagePickerController *picker = [[UIImagePickerController alloc] init]; [picker setDelegate:self]; [picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; [picker setAllowsEditing:YES]; [self presentModalViewController:picker animated:YES]; 但是我想直接去看最新的照片。 这是当你使用iPhone原始相机。 当您点击拍摄照片的缩略图时,照相机会打开并直接显示。 这样做有可能吗?

缺乏对碰撞报告的理解

我有这个崩溃报告。 Incident Identifier: CA9E350A-C842-4349-AAD8-E9E62E93BDD1 CrashReporter Key: 360bc129d2f79a48e291eb5ca38b24e822ed5b6b Hardware Model: xxx Process: OrientalDailyiOS [1502] Path: /var/mobile/Applications/39480A57-68FF-4C46-8445-340EFE204119/OrientalDailyiOS.app/OrientalDailyiOS Identifier: OrientalDailyiOS Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2012-10-14 15:49:10.884 -0700 OS Version: iOS 6.0 (10A403) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0 Last Exception Backtrace: 0 […]

Facebook SDK iOS错误2

我正在尝试使用他们的APIlogin到Facebook [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; }] 我遇到的问题是在iOS 6.x中,当设备有一个Facebook帐户链接在设置应用程序它无法login。它给出的错误是看似一刀切的error 2 。 这是唯一的情况下,我不明白为什么。 什么是让帐户连接时login的解决scheme?

在iOS中检查蓝牙状态

我有一个应用程序(我不会提交这个应用程序到苹果应用程序商店)使用我要检查是否蓝牙打开。 如果打开,那么我必须显示一个警报。 – (void)centralManagerDidUpdateState:(CBCentralManager *)central{ switch (central.state) { case CBCentralManagerStatePoweredOn:{ //alert view break; } } 而在viewdidload我这样做 CBCentralManager * manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; 但是这不适用于使用ios 5.1的ipad2。 问题是central.state始终为空。 我想要从ios 3.0到ios 6 beta的相同场景。 有没有用于检查蓝牙状态的通用代码。 任何可能的代码是受欢迎的,即使代码与私人API。

iOS 6中的UIImagePickerController无法正常工作

我有一个非常奇怪的行为: 在iOS 5中,我以这种方式呈现UIImagePickerController : imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.modalPresentationStyle = UIModalPresentationFullScreen; imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:imagePicker animated:YES]; 现在在iOS 6中,这会导致崩溃。 我通过在UIImagePickerController上编写一个类来解决崩溃问题: @implementation UIImagePickerController (NonRotating) – (BOOL)shouldAutorotate { return NO; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationMaskPortrait; } – (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; } @end 问题是,现在的UIImagePickerController不旋转,它显示正面。 而且,当我按下“取消”button,选取器被解雇,应用程序再次崩溃。 如果我在UIPopoverController使用UIImagePickerController ,所有工作正常(属于UIPopoverController不旋转的事实),但是当我closures在我的应用程序的popup窗口所有视图控制器停止响应旋转事件 ,这导致所有的应用程序被阻止在这个方向。 要恢复正确的行为,我需要从后台退出应用程序,然后再次打开。 这是我用来显示popover的代码 _cameraPopoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; [_cameraPopoverController presentPopoverFromRect:_takeFromCamera.frame […]

向下滚动时,iPhone Storyboard自定义单元消失

我刚刚完成了一个项目,在Storyboard中为我的TableView使用自定义单元格。 问题是,当我向下滚动每个单元格中的内容不见了,在我的情况下是两个标签。 这是我用来呈现每个单元格的代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CustomCell"; MessageCell *cell = (MessageCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[MessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } Message *messageForRow = (Message *)[messages objectAtIndex:[indexPath row]]; [cell.messageLabel setText:[messageForRow message]]; [cell.senderLabel setText:[messageForRow sender]]; return cell; } 我已经在故事板中指定了正确的cellidentifier,并将Class链接到我的自定义单元类。 什么可能是错的? 如果有任何我想错过的信息,请告诉我。 最好的罗伯特

无法使用UILongTouchGestureRecognizer从MKMapView获取坐标

我正在使用iOS 6,而且我已经阅读了很多方法来完成这个任务(包括很多从堆栈溢出),但没有成功。 这是我试过的,分成“阶段”: 创build一个UILongTouchGestureRecognizer来接收MKMapView长触摸。 我尝试通过我的故事板添加一个UILongTouchGestureRecognizer ,并通过Connections Inspector连接sockets,委托等。 我已经尝试以编程方式创buildUILongTouchGestureRecognizer ,使用mapView作为目标进行初始化,将self作为目标,将UILongTouchGestureRecognizer作为目标进行初始化。 使用UILongTouchGestureRecognizer的select器方法接收触摸手势,获取CGPoint并将其转换为CLLocationCoordinate2D对象。 我试过了: 使用[mapView convertPoint:(CGPoint)toCoordinateFromView:self.mapView]; 使用MKMapPoint aPoint = MKMapPointMake(aCGPoint.x, aCGPoint.y); 首先,然后使用MKCoordinateForMapPoint(aMapPoint)来获取CLLocationCoordinate2D 。 直接访问UILongPressGestureRecognizer并使用方法调用中的(UILongPressGestureRecognizer *)sender来获取CGRect的x,y。 结果 简而言之,这就是我使用NSLog检查值时所得到的结果,不pipe使用什么方法。 – 对于UILongPressGestureRecognizer给出的X,Y,x似乎在200和420的范围内波动UILongPressGestureRecognizer的范围在UILongPressGestureRecognizer – 700之间。 – 经过长时间触摸并印在日志上的纬度和经度,奇怪的是,只有在小数点85.051XX(纬度)和-179.9997XX(经度)之后的第三个 – 第六个十进制值之间变化。 这里是我尝试过的一些代码的例子 – (void)viewDidLoad { NSLog(@"View did load"); [super viewDidLoad]; UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:mapView action:@selector(handleLongPress:)]; mapView = [[MKMapView alloc] init]; } – […]

如何从下载的图像获取Exif数据

在我的应用程序中,我需要从特定的URL链接下载图像,并将其分配给UIImageView 。 我不存储该图像到我的图书馆,那么在这种情况下,我怎么能得到这个图像的EXIF数据 (如EXIF_TAG_CREATE_DATE , EXIF_TAG_ARTIST等)在我的应用程序?