草庐IT

delegators

全部标签

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]

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