草庐IT

delegating

全部标签

iphone - 像我们自己的方法一样调用委托(delegate)方法有没有错

当用户单击按钮时,我正在调用mkmapview委托(delegate)方法(regionDidChangeAnimated)。那是正确的方法吗?我们可以调用委托(delegate)方法吗?因为,我有一些代码必须执行我们的用户平移map,所以当用户平移map时自动调用mapview委托(delegate)regionDidChangeAnimated并且当用户按下按钮时我必须执行相同的操作。 最佳答案 如果您问是否可以手动调用委托(delegate)方法,那么答案是肯定的。你可以。但是,这样做可能不是最佳做法。mapView的委托(d

iphone - 警告将方法添加到核心数据的应用程序委托(delegate)中

我使用核心数据创建了一个新项目,然后将我需要的核心数据的所有应用程序委托(delegate)代码复制到我当前的项目应用程序委托(delegate)中。我的appdelegate.m现在看起来像这样。////AppDelegate.m//testingcoredata////CreatedbyiMacon18/11/11.//Copyright(c)2011__MyCompanyName__.Allrightsreserved.//#import"AppDelegate.h"#import"MasterViewController.h"@implementationAppDelegate

iphone - FBRequest委托(delegate)方法请求:didLoad: is not getting called

我正在使用Facebookiossdk进行共享,因为我需要获取用户基本信息,例如userName我正在做类似下面的事情,在@interface@interfaceViewController:UIViewController--------@property(nonatomic,retain)FBRequest*fbRequestObj;在@implementation中-(void)viewDidLoad{fbRequestObj=[[FBRequestalloc]init];[fbRequestObjsetDelegate:(id)self];[superviewDidLoad];

iphone - iOS 上的协议(protocol)、委托(delegate)和数据源

ModelViewController政策规定View不能拥有数据,应该使用委托(delegate)从ViewController请求数据。但是对于exapmleUILabel呢?Controller直接与Outlet对话,例如:self.textfield.text=@"显示此文本"。(这里没有delegate?UILabel也是view的一种?) 最佳答案 对于像在UILabel中设置文本这样简单的事情,委派会不必要地复杂。用UILabel破坏MVC的一个例子是使用它的text属性作为应用中其他地方使用的一段数据的唯一存储。例如

iphone - 触发按钮操作时不会调用 ABNewPersonViewController 委托(delegate)方法

我正在使用ABNewPersonViewController。我正在将完成按钮(ABNewPersonViewController的rightBarButtonItem)保存到另一个按钮,以便委托(delegate)方法-(void)newPersonViewController:(ABNewPersonViewController*)newPersonViewControllerdidCompleteWithNewPerson:(ABRecordRef)person在按下完成按钮之前不会被调用。我的viewDidLoad方法如下-(void)viewDidLoad{[supervie

ios - 第一个 View 中的委托(delegate)方法不会从第二个 View 中调用

在一个View中,我们称它为firstView我创建了一个secondView,如下所示,如果firstView中发生了某些事情,则推送它:SecondViewController*secondVC=[[secondViewControlleralloc]initWithNibName:@"SecondViewController"bundle:nil];[self.navigationControllerpushViewController:secondVCanimated:YES];[secondVCrelease];现在,当我在secondView中时,如果按下按钮,我想返回到f

ios - NSURLConnection 的委托(delegate)方法,要求 authenticationChallenge 没有被解雇?

我使用NSURLConnection调用网络服务,我的钥匙串(keychain)中有一个客户端证书,我在-(void)connection:(NSURLConnection*)connectiondidReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge*)challenge中设置为凭据在我删除此证书并将新证书添加到钥匙串(keychain)后,NSURLConnection仍然保留我已经提供的凭据,并在我删除旧证书之前返回417状态错误代码,即200。有没有办法让NSURLConnection强制要求凭据。?或者如何

iphone - 我如何使一个 View Controller 成为另一个 View Controller 的委托(delegate)?

我的iPhone应用程序中有一个UIViewController。对于某些动画,我在其中制作了一个类似rootview的View,并在其中添加了所有元素。单击按钮时,我删除了该rootview并添加了另一个ViewControllerView。问题是我只加载了View。我想在新ViewController中执行一个函数。为此我需要将第一个ViewController设置为第二个ViewController的委托(delegate)?有人可以帮忙吗我? 最佳答案 在secondVC中,定义如下内容:@protocolsecondVCD

objective-c - 委托(delegate)和保留周期?

编辑:我真的很抱歉。我编辑了我在帖子中犯下的令人困惑的错误。我在WhereamiViewController.h中声明了这些ivars:CLLocationManager*locationManager;IBOutletMKMapView*worldView;IBOutletUITextField*locationTitleField;作者写道,由于WhereamiViewController拥有locationManager并且locationManager的委托(delegate)是WhereamiViewController,locationManager委托(delegate)

objective-c - 在单独的类中设置 MapKit 委托(delegate)的正确方法

为MapKit设置单独的委托(delegate)类的正确方法是什么?我有MapView类子类MKMapView和裸MapDelegate类符合MKMapViewDelegate协议(protocol)只有一个初始化方法。这是我使用的MapView初始化方法的摘录:#MapView.m...@implementationMapView-(id)initWithFrame:(CGRect)frame{if(self=[superinitWithFrame:frame]){//[selfsetShowsUserLocation:YES];[selfsetDelegate:[[MapDeleg