草庐IT

Delegate

全部标签

ios - 如何在@interface 行中定义两个委托(delegate)

在iOS中,我想包含一个用于flipsideView的委托(delegate)(来自实用程序应用程序模板)和一个允许ScrollView的委托(delegate)。我的尝试是:@interfaceMainViewController:UIViewController{}我试图在两个之间放置一个逗号(,)或一个空格,但它不起作用。有人能够并愿意帮助我解决这个问题吗?预先感谢您的帮助 最佳答案 这样做:@interfaceMainViewController:UIViewController{}语法如下:@interfaceClassN

ios - UIView layoutSubviews委托(delegate)

我发现自己想要支持将layoutSubviews的责任委派给UIView。这是为了避免仅仅为了实现layoutSubviews方法而创建一个特定的子类。我怀疑我发现自己想要这种替代方案的原因可能是因为我错过了一些基本的UIKit设计考虑因素,或者?还是我应该继续创建自己的UIView子类以支持这种类型的布局委托(delegate)? 最佳答案 每当您需要自定义布局时,您都会想要创建一个子类,没有办法委托(delegate)。这也是唯一明智的做法-如果您在父View中包含一组View,该View应控制其subview布局以实现可维护性

ios - 未调用 CLLocation 管理器 didStartMonitoringForRegion 委托(delegate)方法

我正在尝试在我的应用程序中使用位置监控。我可以设置我的位置和reverseGeocode我想监控的位置。didUpdateToLocation委托(delegate)方法工作正常,并不断更新,但didStartMonitoingForRegion委托(delegate)永远不会被调用,didExitRegion和didEnterRegion.有什么建议吗?-(IBAction)setLocation:(UIButton*)sender{if(!self.locationManager)self.locationManager=[[CLLocationManageralloc]init]

c# - Unity/Monotouch/C# 中第 3 方库的 JIT 编译方法错误设置委托(delegate)

我正在尝试在Unity/Monotouch/C#中为iOS的facebook创建聊天客户端。我收到以下错误ExecutionEngineException:AttemptingtoJITcompilemethod'(wrappermanaged-to-native)System.Threading.Interlocked:CompareExchange(System.EventHandler`1&,System.EventHandler`1,System.EventHandler`1)'whilerunningwith--aot-only.atMatrix.Net.BaseSocket

objective-c - 设置 App Delegate 以管理数据

我正在开发一个带有SplitViewController的应用程序,我想将主要数据类存储在AppDelegate中,以便我可以从多个View(MasterView、DetailView和几个PopUps)访问它。我有点菜鸟,不知道为什么我会收到错误:AppDelegate.m:31:26:Property'dataController'notfoundonobjectoftype'MasterViewController'以下是相关代码-非常感谢任何帮助。谢谢。AppDelegate.h#import@classEventClassDataController;@classMaster

iphone - 未调用区域委托(delegate)方法的 CLLocationManger

我有要求,我必须为CLLocation设置radius。我在viewDidLoad方法中编写代码如下:-(void)viewDidLoad{[superviewDidLoad];//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.locationManager=[[CLLocationManageralloc]init];[locationManagersetDelegate:self];[locationManagersetDesiredAccuracy:kCLLocationAccuracyBest];[locat

iOS,UIPickerView 以编程方式创建,空 View ,委托(delegate)工作

@大家好,我在使用UIPickerView时遇到了问题。我打算创建一个ViewController,它应该允许用户指定第二天。PickerView应显示诸如“wed,1Dec”、“thu,2dec”等字符串问题是PickerView是空的(PickerView不显示任何字符串)。尽管委托(delegate)方法返回必要的字符串计数和字符串本身。空PickerView的图像-LINK下面是我的代码。.h@interfaceOMSDatePickerViewController:UIViewController@property(nonatomic)NSIntegeramountOfDay

iOS 推送通知 : How to get the "Notification identifier" within the delegate

当我通过APNs向我的iOS应用程序发送推送通知时,大多数情况下一切正常。将收到通知,我可以从application:(UIApplication*)applicationdidReceiveRemoteNotification:(NSDictionary*)userInfofetchCompletionHandler:(void(^)(UIBackgroundFetchResult)的userInfo字典中读取负载))completionHandler方法。但是userData不包含NotificationIdentifier,它是自iOS7以来新的NotificationForma

ios - 当 Exchange 和 iCloud 电话号码在同一个条目中时,ABPeoplePicker 委托(delegate)返回不正确的标识符

我遇到一个问题,即ABPeoplePickerNavigationController似乎为电话号码从Exchange和iCloud同步的联系人返回了错误的标识符。我的应用程序在iOS7.1上运行并使用iOS7.1SDK编译。TL;DR-在人员选择器委托(delegate)回调中,当我有一个联系人将Exchange和iCloud的电话号码合并在一起时,我得到了错误的标识符。抢先回答:是的,我正在调用ABMultiValueGetIndexForIdentifier。只有当我有一个联系人同时使用Exchange和iCloud的电话号码时,才会出现此问题。我运行了使用iOS6.1SDK编译

iOS - 如何获得委托(delegate)类

我怎样才能得到我的委托(delegate)的类别?我想调用类似self.delegate.class的东西,但它不存在。我的目标是调用2种不同的方法,具体取决于哪个类发起了具有协议(protocol)的类。 最佳答案 您可以(并且应该)使用respondsToSelector来检查该委托(delegate)是否能够响应该选择器,而不是试图找出类。例子:if([self.delegaterespondsToSelector:@selector(method1:)]){[self.delegatemethod1:self];}elsei