Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN

Tags:

ios

uibutton

When I'm clicking button I'm getting this exception.I don't know where I'm doing wrong Someone help me .my app is rejected because of this exception my code:

 UILabel *rememberMeLabelObj = [[UILabel  alloc]initWithFrame:CGRectMake(xaxisForRememberMeLabel, yaxisForRememberMeLabel, widthForRememberMeLabel, heightForRememberMeLabel)];
rememberMeLabelObj.text = @"Remember me";
rememberMeLabelObj.font =[UIFont systemFontOfSize:14.0];

rememberMeLabelObj.textColor = [UIColor colorWithRed:0.816f green:0.592f  blue:0.157f alpha:1.00f];
[self.view addSubview:rememberMeLabelObj];
like image 761
App Developer Avatar asked Feb 27 '15 06:02

App Developer


2 Answers

I solved my issue actually I didn't gave float values because of this I got exception.I gave CGFloat and gave values as integer like 400,350,etc but I need give 400.0f .so,I got this issue .Now it was cleared

like image 166
App Developer Avatar answered Sep 29 '22 13:09

App Developer


You are calling UILabel frame methods, and probably calculating the value somehow and the result is a NaN, which means "not a number" and, as you correctly suggested, it can be the result of o divide-by-zero operation.

But it can appear for a lot other reasons: http://en.wikipedia.org/wiki/NaN

Reference: kuba

like image 37
Naeem Avatar answered Sep 29 '22 15:09

Naeem