草庐IT

delegating-constructor

全部标签

ios - 无法配置数据源和委托(delegate)

所以我将Xcode和GitHub项目代码升级到swift3.0(我的项目在ObjC中,我从GitHub使用的一些pod在Swift中)。我遇到了一堆错误,现在我被困在这些错误上了。出于某种原因,我的数据源和floatingActionButton(githere)的委托(delegate)现在不起作用。我尝试以编程方式和Storyboard上设置dataSource和delegate,但没有成功。错误:Property'dataSource'notfoundonobjectoftype'LiquidFloatingActionButton*'Property'delegate'notf

ios - 正确访问 segue 的目标 View Controller 以分配协议(protocol)委托(delegate)

在实现选择列表时,我在集成segue和协议(protocol)时遇到了一些问题。在我的选择列表.h中我有:#import@protocolSelectionListViewControllerDelegate@required-(void)rowChosen:(NSInteger)row;@end@interfaceSelectColor:UITableViewController-(IBAction)saveSelectedColor;@property(nonatomic,strong)iddelegate;@end在我的选择列表.m中,我有:@implementationSele

c# - Xamarin 表单 DisplayAlert 在从委托(delegate)调用的函数调用时不显示

当我从size函数内部调用Greet时,DisplayAlert会按预期显示警报但是,当在事件发生后从委托(delegate)中调用它时,它将使用正确的名称(GreetHasbeenCalled)记录到输出,但DisplayAlert不会节目。publicclassCustomPage:ContentPage{...protectedoverridevoidOnValidSizeAllocated(doublewidth,doubleheight){...Greet("Test");app.FB.GetName();app.FB.NameRecieved+=(s,e)=>{Greet(

IOS:两个tableview的tableview委托(delegate)方法

我在一个类中有一个TableView的委托(delegate)方法:-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{return1;}-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{return[array1count];}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndex

iphone - 将在 Interface Builder 中创建的 UITabBarController 设置为委托(delegate)

我使用TabBar模板创建了我的iOS应用程序,所以这里是带有条形按钮的UITabBarController。一个问题是如何将其设置为委托(delegate)。我在SO发现它必须在AppDelegate中以编程方式设置,但我认为这是不可能的,因为我无法访问TabBarController作为导出。我为@interface添加了正确的值(包括ViewController和AppDelegate),但不知道下一步该做什么。@interfaceViewController:UIViewController我希望我不必摆脱整个应用程序模板,并且可以将在IB中创建的TabBarControlle

ios - 从应用程序委托(delegate)获取当前 View Controller (模态是可能的)

我知道要从应用委托(delegate)获取当前ViewController,我可以使用为我的应用设置的navigationController属性。但是,在我的应用程序的许多地方,模态导航Controller可能已经呈现。有什么方法可以从应用程序委托(delegate)中检测到这一点,因为当前的导航Controller将不同于应用程序委托(delegate)持有引用的导航Controller? 最佳答案 基于gisthere,我创建了一个类别来获取最顶层的ViewController,这样调用[[UIApplicationshare

ios - 我的 iOS 委托(delegate)方法是否应该始终在主线程上返回?

这是一个“最佳实践”问题,我似乎无法在网上找到好的答案。我正在创建一个静态代码库,它提供了几个用于进度反馈的委托(delegate)方法。库管理它自己的队列,所以下载之类的事情显然不是在主线程上完成的,但我的问题是我应该确保我的委托(delegate)方法总是在主线程上调用,还是从我正在使用的排队线程?如果他想在我的委托(delegate)方法中进行UI更新,是否依赖于使用该库的开发人员检查他是否在主线程上?干杯,山姆 最佳答案 您可以采用任何一种方式;您只需要将其记录下来即可。有些API会在主线程上回调您,有些会在您用来开始工作的

ios - 在 block 中引用 iOS 应用程序委托(delegate)是否会创建委托(delegate)对象的副本?

考虑以下示例:-(void)exampleFunction{AppDelegate*appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];SomeClass*classObject=[[SomeClassalloc]init];[classObjectsomeFunctionThatDoesBackgroundWorkAndCallsACompletionBlock:^(NSDictionary*results){SomeNeatObject*object=appDelegate.someNeatObj

iOS 5 UIWebview 委托(delegate) : WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction

我正在使用委托(delegate)方法shouldStartLoadWithRequest来捕获链接点击并处理我的应用程序内的特定情况,而不是让webView导航到链接。在这段代码中,我试图将一个新的ViewController压入堆栈。在尝试推送View后,我立即崩溃,并在我的控制台中显示以下消息:WebKitdiscardedanuncaughtexceptioninthewebView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate:我的代码是这样的:-(BOOL)webView:(U

iphone - 检查委托(delegate)是否响应可选选择器的最佳方法

我已经习惯了将@optional委托(delegate)的方法发送到:if([self.delegaterespondsToSelector:@selector(method:)]){[self.delegatemethod:obj];}它工作得很好,但是如果有很多委托(delegate)的方法,它看起来像是在复制respondToSelector:代码...在某个时间点,我将respondsToSelector:放在单独的方法中://ignorewarning#pragmaclangdiagnosticignored"-Warc-performSelector-leaks"-(voi