草庐IT

def_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

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]