Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 不通过实例方法_Iphone_Ios_Ipad - Fatal编程技术网

Iphone 不通过实例方法

Iphone 不通过实例方法,iphone,ios,ipad,Iphone,Ios,Ipad,我正在尝试做一个应用程序,但不幸的是它没有通过所有(void)实例方法(我从另一个项目复制了这些方法)。。。。 而且也没有显示出任何错误……有人能告诉我出了什么问题吗????? 我正在构建一个应用程序,其中包含textfeild和下拉表 方法如下: - (void)finishedSearching; - (void)searchAutocompleteEntriesWithSubstring:(NSString *)substring; - (void)touchesBegan:(NSSet

我正在尝试做一个应用程序,但不幸的是它没有通过所有(void)实例方法(我从另一个项目复制了这些方法)。。。。 而且也没有显示出任何错误……有人能告诉我出了什么问题吗????? 我正在构建一个应用程序,其中包含textfeild和下拉表

方法如下:

- (void)finishedSearching;
- (void)searchAutocompleteEntriesWithSubstring:(NSString *)substring;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

#pragma mark UITextFieldDelegate methods

- (BOOL)textFieldShouldReturn:(UITextField *)textField ;
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string ;

#pragma mark UITableViewDelegate methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView ;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section ;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath ;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

请建议

正确设置代表,您需要做以下事情-

  • 确认委派协议。例如-

    YourClass:SomeClass
    ->这是代表确认

  • 设置要在其中创建控件的委托。例如-

    UItextField*myTextField=[[UItextField alloc]init]
    
    ---
    myTextField.delegate=self

  • 现在需要在类中提供该委托所需方法的定义

  • 希望一切都会好起来。

    .h

    @interface YourClasss
    YourClass : ParentClass < UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource >
    @end
    
    在您的.h文件中

    @interface Class
    Class : NSObject < UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource >
    @end
    

    这是.h还是.m文件?请确保您的textfield和tableview委托是set@janusfidel:如果创建UITable和UItext字段,如何设置委托programatically@pradeepj不只是复制代码,也许您应该了解它的实际功能和工作原理,以便知道如何修复类似的问题?仅仅说“它不起作用”并不能真正帮助我们帮助您。有一件事我用代码创建了一个表,如何将委托设置到该表中你只需要添加一行代码-table.delegate=self;同样在.h文件中,您需要有;然后您需要实现表视图所需的委托方法。它甚至不打印-(void)print{NSLog(@“a”);}您需要显示更多的代码,您可以添加.h和.m文件。
    @interface Class
    Class : NSObject < UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource >
    @end
    
    viewDidLoad
    {
    
     tblViewVar.delegate = self;
     tblViewVar.dataSource = self;
     tblViewVar.delegate = self
    
    [super viewDidLoad];
    }