UIButton不会变灰

UIButton在启用时不应该变成灰色/灰色= NO? 我在blackbackground上有一个简单的UIButton(没有自定义图像,没有自定义的东西,只是用IB拖动它,改变大小和标题)。 当我将它设置为禁用时,它仍然是白色的! 现在,我正在使用一个小的愚蠢的解决方法:隐藏blackbg 0,5 alpha的UIView在隐藏的button顶部= NO当我需要禁用button…但我想设置button正确… 有什么想法吗?

获取当前的调度队列?

我有一个应该支持从任何队列中调用的方法,并且应该期望。 它在后台线程本身中运行一些代码,然后在返回值为block参数时使用dispatch_get_main_queue。 如果不是当它进入方法时,我不希望它强制进入主队列。 有没有办法获得一个指向当前调度队列的指针?

如何使用Swift将文本文件加载到数组中?

如何使用swift将文本文件加载到array ?

如何禁用UIBarButtonItem?

我有一个UIBarButtonItem只是不想被禁用。 短版:当我打电话 [myBarButtonItem setEnabled:NO]; 什么都没发生。 myBarButtonItem是myBarButtonItem中的IBOutlet。 在Interface Builder中, myViewController作为一个对象添加到MainWindow中。 myBarButtonItem出口已连接到BarButtonItem,并具有相应的@syntesize和property行设置。 @property (nonatomic, retain) IBOutlet UIBarButtonItem *myBarButtonItem; 在myViewController.m中, @synthesize myBarButtonItem; 任何人都有一个想法,为什么上面的setEnabled方法没有影响? 谢谢! 更新:修正了它! 不知道为什么,但显然没有设定的出路。 我用我的应用程序委托作为UIBarButtonItem的父对象,所有的工作。

通过navigationController通过segue传递数据

我试图将数据从一个viewController到另一个。 我已经连接一个viewController到另一个ViewController的navigationController,然后设置标识符为"showItemSegue" 。 我在这两行中得到一个错误: var detailController = segue.destinationViewController as ShowItemViewController detailController.currentId = nextId! 图像插图: 代码: override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { nextId = itemArray?.objectAtIndex(indexPath.row).objectForKey("objectId") as? NSString self.performSegueWithIdentifier("showItemSegue", sender: self) } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { if (segue.identifier == "showItemSegue") { var detailController = segue.destinationViewController as ShowItemViewController detailController.currentId = nextId! } }

使用私有API在iOS中检测热点

好的,所以我想检测天气用户已启用热点/ tethering或不在iOS设备。 我可以使用私人API知道它不会让它到应用程序商店。 我试图通过私人api的列表/运行时标题,但有太多,以决定哪些可能会有所帮助。 或者如果我能知道UIApplicationWillChangeStatusBarFrameNotification从私人API(可能被称为主动呼叫和激活热点等)被解雇, 我试图检测个人热点 ,也使用CaptiveNetwork,但它只返回连接的Wi – Fi ssid,而不是创build的热点。 任何知识共享将是非常有益的 更新:@creker 使用上面的代码编译器显示错误“SCDynamicStoreCreate不可用:iOS上不可用。所以我进入SCDynamicStore.h并更改以下 SCDynamicStoreRef SCDynamicStoreCreate ( CFAllocatorRef allocator, CFStringRef name, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA); 至 SCDynamicStoreRef SCDynamicStoreCreate ( CFAllocatorRef allocator, CFStringRef name, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_6_0); 现在我能够得到与1022和1023状态的字典。只是想通过改变文件这样(以前没做过)来确认我将有任何问题在归档构build(或任何其他问题),除此之外,事实上,我们知道这个代码不会让它到应用程序商店

地理位置和当地通知一样提醒

我想实施地理位置通知,如应用程序提醒。 这是我已经做了: 在App委托中: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; /* don't leak memeory! */ [self.locationManager setDelegate:self]; [self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { } 而这个在视图控制器中的女巫开始监视: CLLocationCoordinate2D location2D = mapView.region.center; CLRegion *regionForMonitoring = [[CLRegion alloc] initCircularRegionWithCenter:location2D radius:1 identifier:@"RegionIdentifier"]; [[Utils getLocationManager] startMonitoringForRegion:regionForMonitoring]; 现在我不知道要用这些信息来触发本地通知。

MBProgressHUD没有显示

在我的应用程序中,我正在加载资源沉重的视图,需要大约1到2秒加载。 所以我加载它在这样一个单独的线程: hud = [[MBProgressHUD alloc] init]; [hud showWhileExecuting:@selector(loadWorkbench:) onTarget:self withObject:nil animated:YES]; 但是它永远不会出现,并且应用程序看起来被冻结给最终用户。 任何想法,我已经出错了?

在iOS / Swift中获得系统正常运行时间

有没有办法让系统正常运行在iOS(使用Swift)? 我需要的是测量时间,而不必担心用户改变时间。 在Android中有一个elapsedCurrentTimeMillis() ,它返回自启动以来的毫秒数,但现在我需要类似于iOS的东西。 这里有一个可以接受的答案获得iOS系统的正常运行时间,这不会暂停,但是这是Objective C,我需要它为Swift,我不知道如何转换它。

扫描设备在LANnetworking中的方式

我想在局域网内进行扫描以find链接的设备。 我正在为IOS开发一个IOS应用程序,我该怎么办?