这里NsmutableString = textInProgress,count1是计数器管理的.
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
NSLog(@"%d",count1);
// Build the text value
[textInProgress appendString:string];
NSLog(@"%@",textInProgress);
NSLog(@"%d",count1);
count1=count1+1;
}
Run Code Online (Sandbox Code Playgroud)
textInProgress在日志中打印时,它返回null值.输出的一部分: -
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] 0
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] (null)
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] 0
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] 2
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] (null)
2016-02-26 03:29:50.047 Hello_SOAP[3684:118829] 2
Run Code Online (Sandbox Code Playgroud)
在任何其他方法中我没有使用此方法,而是没有增加count1变量
我使用了性别单选按钮如下:-
<td><input type="radio" name="gender" value="male" checked required="required"> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other</td>
Run Code Online (Sandbox Code Playgroud)
但是这种“必需的”验证无法在不使用 JavaScript 的情况下对其进行验证。
在AppDelegate.h中
@property(strong,nonatomic)NSString *str2;
Run Code Online (Sandbox Code Playgroud)
在ViewController.m中
AppDelegate *c3=[[AppDelegate alloc]init];
c3.str2= @"Hello";
NSLog(@"Output:-%@",c3.str2);
Run Code Online (Sandbox Code Playgroud)
输出:你好
Tableview中的导航代码didselect方法(视图控制器): -
Class2 *c2=[self.storyboard instantiateViewControllerWithIdentifier:@"cl2"];
[self.navigationController pushViewController:c2 animated:YES];
Run Code Online (Sandbox Code Playgroud)
在Class2.m中: -
AppDelegate *c3=[[AppDelegate alloc]init];
NSLog(@"%@",c3.str2);
Run Code Online (Sandbox Code Playgroud)
输出:-null