指南针校准目标-c

我尝试在我的iOS应用程序中使用指南针。 我有一个问题。 如果我实现了locationManagerShouldDisplayHeadingCalibration方法并return YES ,那么校准显示总是显示。 但我应该像苹果地图一样。 即有时需要显示校准显示。 当罗盘应该校准。

如何在不增加背景图像大小的情况下增加(自定义types)UIButton的可打(打)区域

是否可以增加UIButton的可打印区域而不改变Button的背景图像的大小 我试过了: [shareButton setContentEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)]; & [shareButton setImageEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)]; 但没有一个工作。 有什么build议吗?

目前UIActivityViewController- LaunchServices:invalidationHandler调用

我已经在这里和这里看到了相关的问题,并且我已经实现了build议的解决scheme,但是无济于事。 我有一个UIBoolButtonItem UIToolbar,与发送操作连接到btnTBAction_touch: 在ViewController的类头中我有: @property (nonatomic, strong) UIActivityViewController *activityViewController; 类实现中的相关方法: – (IBAction)btnTBAction_touch:(id)sender { NSString *string = @"Some string"; NSURL *url = [[NSURL alloc] initWithString:@"http://www.google.com"]; UIImage *image = [UIImage imageNamed:@"default.png"]; self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[string, url, image] applicationActivities:nil]; if ([self.activityViewController respondsToSelector:@selector(popoverPresentationController)]) { UIPopoverPresentationController *presentationController = [self.activityViewController popoverPresentationController]; presentationController.sourceView = sender; } [self presentViewController:self.activityViewController animated:YES completion:nil]; } […]

GCDAsyncUdpSocket和多播发送和接收

在第一种方法中,我创build了基于sampleProject的客户端 – 服务器应用程序,它将一些数据发送到服务器。 Legend: sender address = reciver ip port = reciver port reciver address = null since he is listening port = in my case 55555 工作代码 跳过错误检查只是为了公共的原因 寄件人 -(id*)initForSender:(NSString*)address port:(int)port { self = [super init]; if (self) { _port = port; _address = address; tag = 0; _udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; […]

在iOS设备上运行networking服务器

我想创build一个可以在其他iOS设备之间共享文件的应用程序,也可能是台式计算机。 所以我想要做的是在我的设备上运行一个轻量级的Web服务器,从而允许从设备上下载文件,如下所示: HTTP://myphone.local:1234 /文件夹/ samplefile.txt 如何在非越狱设备上提供这样的服务器。 我不想从头开始编写这样的服务器:-)。 非常感谢你的帮助

UISearchDisplayController不正确显示自定义单元格

所以我有一个tableView有部分和行,它使用自定义单元类。 自定义单元格有一个图像视图和一些标签。 表视图工作正常,search工作,除了search不显示任何在我的自定义单元类中的标签,只有imageView与正确的图像。 我很困惑,为什么这是,尤其是因为图像仍然显示,而不是标签。 这是一些代码。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //TODO: problem with search view controller not displaying labels for the cell, needs fixing JSBookCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if(cell == nil) { cell = [[JSBookCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } JSBook *book = nil; //uses the appropriate array to pull the data from […]

如何在UIViewanimation过程中animationUIView图层的子图层?

在视图的UIViewanimation中,通过在[UIView animateWithDuration:delay:options:animations:completion:]的options参数中包含UIViewAnimationOptionLayoutSubviews ,可以为其子视图设置[UIView animateWithDuration:delay:options:animations:completion:] 。 然而,当我们不是某个视图的背景层的时候,我找不到一个方法来为它的子层设置animation。 他们只是跳到适当的位置,以配合视图的新界限。 由于我正在使用图层而不是视图,看起来像我不得不使用核心animation而不是UIViewanimation,但我不知道如何(和何时)做到这一点,使图层animation将匹配视图animation。 这是我的基本问题。 如果你想知道我想要完成的具体事情,请阅读更多内容。 我已经创build了一个带有虚线边框的视图,在视图的图层中添加了一个CAShapeLayer(参见这个stackoverflow问题: UIView周围的虚线边框 )。 我调整了CAShapeLayer的path以匹配layoutSubviews视图的边界。 这个工作,但有一个化妆品的问题:当视图的边界animation在一个UIViewanimation(如在旋转期间),虚线边框跳转到视图的新边界,而不是平滑的animation,因为视图animation的边界。 也就是说,当视图animation时,虚线边框的右侧和底部不分别保持与视图的右侧和底部部分相邻。 我怎样才能从CAShapeLayer的虚线边界animation的边界animation的视图旁边? 我到目前为止所做的是将一个CABasicAnimation附加到CAShapeLayer上: – (void)layoutSubviews { [super layoutSubviews]; self.borderLayer.path = [UIBezierPath bezierPathWithRect:self.bounds].CGPath; self.borderLayer.frame = self.bounds; CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; [self.borderLayer addAnimation:pathAnimation forKey:nil]; } 这确实会使虚线边框生成animation,但它没有正确的计时function和animation持续时间以匹配视图animation。 另外,有时候,我们不希望虚线边框动起来,就像当视图第一次布局时,边框不应该从一些旧pathanimation到新的正确path; 它应该只是出现。

如何在iOS 7中使用animation隐藏状态栏?

自iOS 7推出以来,我无法像iOS 6那样显示或隐藏状态栏。现在我使用NSTimer来控制它何时隐藏。 这里是我的代码: – (void)hideStatusBar{ _isStatusBarHidden=YES; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } – (void)showStatusBar{ _isStatusBarHidden=NO; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } //=================== _controlVisibilityTimer = [[NSTimer scheduledTimerWithTimeInterval:4 target:self selector:@selector(hideStatusBar:) userInfo:nil repeats:NO] retain]; 但不幸的是,状态栏隐藏的方式似乎有点粗糙,没有消失。 有人在这里有一个解决scheme? 更新 我解决了隐藏的问题,使用@hahaha解决scheme。 我只需要一个视图作为状态栏的背景,这里是我的代码。 AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate]; self.StatusBarOrange = [[UIView alloc] initWithFrame:CGRectMake(0, 0, appDelegate.window.frame.size.width, 20)]; [self.StatusBarOrange setBackgroundColor:[UIColor orangeColor]]; [appDelegate.window.rootViewController.view addSubview:self.StatusBarOrange]; 现在一切正常!

如何使用MasterDetail应用程序模板更新DetailView

我不熟悉使用分割视图来创buildiPad应用程序。 当我第一次使用标准的MasterDetail Application模板(Xcode 4.2)创build项目时,它创build了一个MasterViewController和一个DetailViewController。 从popup式表格(主细节视图控制器)中select一行时,模板具有以下方法: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath if (!self.detailViewController) { self.detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; } [self.navigationController pushViewController:self.detailViewController animated:YES]; 现在我明白,如果您正在为iPhone编程,那么当您使用常规导航控制器时,您只需执行此类操作即可将另一个视图控制器推入堆栈。 然而,使用这个模板,它只是将细节视图放到popover上,而不是更新已经存在的内容。 我很困惑,因为我需要更新从popup窗口(主细节视图)中select一些东西,然后有detailView更新。 更新: 为了试着在DetailViewController中testing已经为你设置的“detailItem”,我注释掉了pushViewController并添加了以下内容: //[self.navigationController pushViewController:self.detailViewController animated:YES]; self.detailViewController.detailItem = @"Test"; // setter in detailViewController – (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [self configureView]; […]

苹果商店提交失败,错误ITMS-90046,但关联的域名不属于权利

当我第一次构build我的应用程序和Watchkit应用程序时,我启用了“关联的域”function。 我已经在watchkit扩展和伴侣应用程序的“function”面板中禁用了它,并确认了每个info.plist中的密钥都已经消失。 我已经到了Apples的“证书,标识符和configuration文件”页面,为每个Watchkit应用程序select了应用程序ID,分机和应用程序,未勾选“关联的域”,为每个应用程序重新生成configuration文件,下载并安装它们。 我完成了一个Ctrl-Shift-Command-K完成清理,重启和重build。 在sumbission上的appstore我得到下面的错误信息。 我在xcode中完成了项目search,找不到com.apple.developer.associated-domains项。 我search了build立目录,纳达。 我不相信这个密钥实际上存在于我的代码中,但iTunesConnect似乎认为它在那里并设置为“*”。