草庐IT

Delegate

全部标签

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)一起工作?

ios - map View :didDeselectAnnotationView: delegate method getting called before the annotation view is actually deselected

我正在使用填充有自定义图钉的mapView。当用户点击map上的某处取消选择一个图钉时,我想实现map,以便该图钉不会被取消选择(即用户无法在不选择其他图钉的情况下取消选择图钉,因此始终至少选择一个图钉).这是我对didDeselectAnnotationView方法的实现:-(void)mapView:(MKMapView*)mapViewdidDeselectAnnotationView:(MKAnnotationView*)view{[mapViewselectAnnotation:view.annotationanimated:NO];}本质上,我正在尝试重新选择注释。然而,经

ios - 使用 MKAnnotationView 委托(delegate)时引脚消失

我的MKAnnotationView委托(delegate)方法已被调用,因为我可以看到我的NSLog输出。但是,图钉没有出现在map上。我在这里遗漏了什么吗?MapViewController.h#import#import@interfaceMapViewController:UIViewController@property(weak,nonatomic)IBOutletMKMapView*nearbyMapView;@endMapViewController.m#import"MapViewController.h"#import"AppDelegate.h"@interfac

iOS 和 Xcode : incompatible type error when setting delegate and datasource in a UITableView

我正在尝试以编程方式制作一个应用程序,其中包含一个UITableView,该UITableView根据应用程序的文档目录中的文件生成项目列表。我已经能够将文件读入数组_filepathsArray,但是当我尝试使用数组填充表格时编译崩溃并且Xcode抛出警告。Xcode指出以下行的问题:_tableView.delegate=self;_tableView.dataSource=_filepathsArray;这两者都会引发“语义问题”。第一次抛出`Assigningto'id'fromincompatibletype'NSArray*__strong'`,当第二个抛出`Assigni

ios - 如何在应用程序委托(delegate) (obj-c) 中添加 UIAlertController

这是我在弃用UIAlertView之前使用的代码://OLDUIALERTVIEW-(void)applicationDidBecomeActive:(UIApplication*)application{//Restartanytasksthatwerepaused(ornotyetstarted)whiletheapplicationwasinactive.Iftheapplicationwaspreviouslyinthebackground,optionallyrefreshtheuserinterface.//checktoseeifnewerversionexiststoa

objective-c - 将委托(delegate)设置为父 View Controller

我的应用程序中有三个ViewController被推送到导航Controller。当我在第三个ViewController上时,我想向第一个ViewController发送消息。我认为代表是前往此处的方式,但我无法正确设置它。在我的第三个ViewController的h文件中,我有这个:@protocolAddSudokusViewControllerDelegate-(void)saveSudoku:(Sudoku*)sudoku;@end@interface[...]iddelegate;[...]@property(nonatomic,retain)iddelegate;然后我在

iPhone:如何在自定义单元格的动态数量上管理 UITextfield 委托(delegate)方法

我的表格View中有动态数量的文本字段,我将每个文本字段放入IB中的自定义单元格中,并通过nibName加载单元格。我想在用户输入数据时验证并显示警报,同样在editingisDone时我想从用户那里获取输入值并将其保存到相关对象中。例如,这些是我可以使用的一些委托(delegate)方法:-(void)textFieldDidEndEditing:(UITextField*)textField{//savethedata}-(IBAction)textFieldDoneEditing:(id)sender{//hidethekeypadwhendoneispressed[sender

iphone - UIAlertView 能否通过委托(delegate)传递字符串和 int

我有一个UIAlertView(实际上有几个),我正在使用方法-(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex来触发一个Action,如果用户不按取消。这是我的代码:-(void)doStuff{//complicatedtimeconsumingcodeheretoproduce:NSString*mySecretString=[selfcomplicatedRoutine];intmyInt=[selfotherComplicatedRoutine];UIAlert