English 中文(简体)
说我的方法是错误的?
原标题:What am i doing wrong with calling my method?

我拿不到。 i 成为目标的新堡垒,而我在这里做的是错事。 我在建立我的法典时有以下错误:“Class”方法+ValidateUserInfo:strPwd:没有发现”。 我确信,这对你们当中的一些人来说是简单的,只是看到我的错误。 采用我的方法的正确方式是<代码>ValidateUserInfo?。

@implementation LoginViewController

-(IBAction)CheckInfo:(id)sender
{
   NSString *strUserName = [[txtUsername text] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    NSString *strPass = [[txtPass text] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

   [LoginViewController ValidateUserInfo:strUserName myPass:strPass];
}

+(void)ValidateUserInfo:(NSString *)name myPass:(NSString*)strPwd
{
    NSLog(@"VALIDATE user: %@",name);
    NSLog(@"VALIDATE pwd: %@",strPwd);
}

@end
最佳回答

这看起来是罚款,它是否是汇编者警告? 如果是这样,那是因为你没有在主人档案中宣布这种方法。

在标题中添加以下条目:@end

+(void)ValidateUserInfo:(NSString *)name myPass:(NSString*)strPwd;
问题回答

这一错误与你的代码样本相匹配。 你们是否确信这部法律给你带来了错误? 您是否能够从档案中表明该方法的申报?

你们的错误说出一种称为一种方法。

ValidateUserInfo:strPwd 

找不到,但你的法典呼吁和实施一种称为“方法”。

ValidateUserInfo:myPass. 

请注意,方法名称应从较低案卷开始。

You are calling ValidateUserInfo:strPwd: but according to your code it should be ValidateUserInfo:myPass!

+(附加标志)为同级方法

- (主要标志)

。 从小的密码中,你给我的信认为ValidateUserInfo是一种“阶级”方法。

......

+(void)ValidateUserInfo:(NSString *)name myPass:(NSString*)strPwd
{
    NSLog(@"VALIDATE user: %@",name);
    NSLog(@"VALIDATE pwd: %@",strPwd);
}

应当

-(void)ValidateUserInfo:(NSString *)name myPass:(NSString*)strPwd
{
    NSLog(@"VALIDATE user: %@",name);
    NSLog(@"VALIDATE pwd: %@",strPwd);
}

添加到<条码>+(避免) Pwd;至@interfaceloginViewController(优待解决)。

或仅仅实施<条码>+(避免)ValidateUserInfo:NSString*) Pwd before -(IBAction)CheckInfo:id)sender/code>.

阁下,确保你宣布这一方法。 例如:

@interface 观察员: 律师事务所 页: 1

iii

+(ave)ValidateUserInfo:NSString name myPas:NSStringstrPwd;

页: 1

此外,作为副手,你的方法名称应当开始降低。

变化:

[LoginViewController ValidateUserInfo:strUserName myPass:strPass];

:

 [self ValidateUserInfo:strUserName myPass:strPass];




相关问题
Python: Binding method

In following example I am trying to bind a method object via types.MethodType(...). It does not seem to work. Any suggestions? Thanks in advance. import types class Base: def payload(self, *args)...

Invoking an instance method without invoking constructor

Let s say I have the following class which I am not allowed to change: public class C { public C() { CreateSideEffects(); } public void M() { DoSomethingUseful(); } } and I have to call M ...

Behaviour of final static method

I have been playing around with modifiers with static method and came across a weird behaviour. As we know, static methods cannot be overridden, as they are associated with class rather than instance....

Setting the Page-Title in .Net using C# from a Class

Question, How do i set the title of a page from a class. Is it even possible? I can and have set the page title from a page itself and a usercontrol. Can I, How Do I do this via a class using C# ....

how to drag in the animation in iphone application?

Iphone application is using the static co-ordinates to reach at some points in the application,which is based on the button event. But what i want is when i drag the item than it should reach at some ...