http://code.google.com/p/scm-subversion/source/browse/trunk/iPhone/CalendarTest/?r=4#CalendarTest%253Fstate%253Dclosed日历API变化
我正在使用上面提到的Calendar API。在CalendarTestViewController.m类中,我们获取日期。现在我已经声明了一个全局变量nsstring类型,我想通过使用全局变量将该日期用于另一个新类。我已经尝试了很多次,但无法获得输出结果。如果有人知道如何通过Calendar API使用所选日期,那么请给我一些解决方案。
在此先感谢。
CODE
- (void)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile{
NSLog(@"Date Selected is %@",[aTile date]);
str=(NSString *)[aTile date];
}
NSLog(@"str:%@",str);
glbdate1 = (NSString *)[aTile date];
NSLog(@"glbdate1:%@",glbdate1);
}
//I have declared the glbdate1 variable globally in app delegate file and i have made the new class calenderview
//I want to display the date in textfield by using global variable. Here is code in calenderview
-(void)viewWillAppear:(BOOL)animated {
if ([glbdate1 length] != 0)
{
from.text = glbdate1;
}
}
添加笏ü甲肝试过的一些代码.. – KingofBliss
- (空)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile { \t的NSLog(@ “选择的日期是%@”,[aTile date]); (@“str:%@”,str);} \t str =(NSString *)[aTile date];} \t NSLog \t \t glbdate1 =(NSString *)[aTile date];我已经在应用程序委托文件中全局声明了glbdate1变量,并且我已经创建了新的类calenderview我想通过使用全局变量在文本字段中显示日期。这里是calenderview中的代码 - (void)viewWillAppear:(BOOL)动画 if([glbdate1 length]!= 0){ \t from.text = glbdate1; } –