开发者

Copy NSdate Object

开发者 https://www.devze.com 2023-03-19 20:18 出处:网络
I am calling one function from an开发者_Go百科other view controller which is passing NSDate object to that function which is another view controller, but At that function passed date is not goin to be

I am calling one function from an开发者_Go百科other view controller which is passing NSDate object to that function which is another view controller, but At that function passed date is not goin to be assigned/ copying to another local NSDate object.

Here is my code.

 - (void)setDefaultCalendarDate:(NSDate *)aDate {

        self.backgroundColor = [UIColor clearColor];
        selectedNSDate = [aDate copy]; 
//selectedNSDate=aDate;

How to copy aDate into selectedNSDate? When I take NSlog for it I get null


You're almost certainly getting nil because aDate is already nil, so copying it gets you nothing.

Try NSLog(@"%@", aDate) -- what does it say?


selectedNSDate = aDate surely? or if needed selectedNSDate = [aDate retain];

0

精彩评论

暂无评论...
验证码 换一张
取 消