草庐IT

def_delegate

全部标签

ios - 未调用 UITextField 委托(delegate)方法

所以我在UIViewController(不是TableViewController)中的UITableView的单元格中有一系列文本字段。我可以编辑文本字段,但不会调用诸如-(BOOL)textFieldShouldBeginEditing:(UITextField*)textField之类的委托(delegate)方法。ViewController有它的委托(delegate)集:@interfaceNRSignUpViewController:UIViewController声明的字段:@property(nonatomic,strong)UITextField*firstNam

ios - 在多个 Controller 中重用相同的委托(delegate)方法?

我有一个UITextFieldDelegate方法shouldChangeCharactersInRange在多个ViewController中完全相同,所以我必须将它复制粘贴到每个符合UITextFieldDelegate。我喜欢坚持DRY,在这里我在很多ViewController中都有相同的代码。是否可以重用委托(delegate)方法,什么是好的方法,或者这是唯一/最佳的方法,为什么? 最佳答案 创建UIViewController的子类,它仅实现您希望的委托(delegate)方法。将其设置为项目中所有希望使用委托(del

iOS - 在 didFinishLaunchingWithOptions 委托(delegate)之前调用 viewDidLoad?

我有一个按预期运行的应用程序。但是,我在rootViewController的viewDidLoad方法的第一行放置了一个断点,在委托(delegate)的didFinishLaunchingWithOptions的第一行放置了另一个断点,令我惊讶的是,应用程序进入了viewDidLoad方法,然后转到didFinishLaunchingWithOptions,然后又执行了一次viewDidLoad方法。这是怎么回事?我认为这种行为是完全错误的。提前致谢!#已编辑这是我的iPad委托(delegate)didFinishLaunchingWithOptions方法:-(BOOL)app

iphone - 委托(delegate)方法协议(protocol)不工作 - Objective-C

我正在为我的iPad开发一个splitView应用程序。我实现了一个名为Upload的UIButton。单击它时,UITableView会出现在UIPoverController中。单击任何内容后,我想在UIDetailView中的UIwebView中显示一些相应的站点。为此,我实现了一个委托(delegate)方法协议(protocol)。我在UploadTableViewController.h文件中使用了以下代码行::@protocolUploadTableViewDelegate@required-(void)selected:(NSString*)his;@end@inter

ios - 返回值对 UI TextField 委托(delegate)方法 textFieldShouldReturn :? 意味着什么

苹果文档提供:Asksthedelegateifthetextfieldshouldprocessthepressingofthereturnbutton.-(BOOL)textFieldShouldReturn:(UITextField*)textFieldParameterstextFieldThetextfieldwhosereturnbuttonwaspressed.ReturnValueYESifthetextfieldshouldimplementitsdefaultbehaviorforthereturnbutton;otherwise,NO.DiscussionThet

ios - 无法在 NSURLSession 委托(delegate)方法中更新用户界面

-(void)URLSession:(NSURLSession*)sessiondownloadTask:(NSURLSessionDownloadTask*)downloadTaskdidWriteData:(int64_t)bytesWrittentotalBytesWritten:(int64_t)totalBytesWrittentotalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite{floatprogress=(float)((float)totalBytesWritten/(float)totalBytesE

iOS 我可以将所有委托(delegate)方法放在另一个类上吗?将委托(delegate)继承到 View Controller 中

我想要的是将我所有的委托(delegate)方法集中到一个类中。我可以在其中使用其默认值或重写委托(delegate)方法。例如:ViewController.m#import@interfaceViewController:UIViewController@endViewController.h#import"ViewController.h"#import"TableDelegateContainers.h"@interfaceViewController()@end@implementationViewController-(void)viewDidLoad{[superview

ios - 在实现 mapView :didTapMarker: delegate method implemented 时在 google maps iOS sdk 中点击标记时显示信息窗口

好的,这是一个很长的标题。我在使用googlemapsiOSsdk时遇到了问题。我想显示一个关于用户点击的标记的信息窗口。根据文档,如果GMSMarker的snippet和title属性都被选中,则当用户点击该标记时,将显示信息窗口。但我还实现了mapView:didTapMarker:GMSMapViewDelegate协议(protocol)中的方法。如果我注释掉该方法信息窗口可见,否则信息窗口不可见。那么,当该方法实现时,我该如何显示信息窗口呢? 最佳答案 实现GMSMapViewDelegate的mapView:didTap

ios - NSFetchedResultsController 委托(delegate)方法调用谓词更改

我有一个简单的应用程序,其中有国家有城市,而城市又有人。我想在表格View中显示国家列表。我使用NSFetchedResultsController来获取所有数据。这是设置:-(void)initializeFetchedResultsController{NSFetchRequest*fetchRequest=[[NSFetchRequestalloc]initWithEntityName:@"Country"];fetchRequest.sortDescriptors=@[[NSSortDescriptorsortDescriptorWithKey:@"name"ascending

ios - UITableView 中的多个委托(delegate)/数据源

Objective-cdelegates一次接受一个instance就像我有两个viewcontrollers并且都实现相同的委托(delegate),但只是目前呈现的viewcontroller接收回调。如果我在同一个viewcontroller中有两个uitableviews两个uitableview'sdelagatesdatasource设置为tb1.datasource=self;tb2.datasource=self;tb1.delegate=self;tb2.delegate=self;uitableview如何与同时定义的委托(delegate)一起工作?