ios - CGAffineTransformMakeRotation -
i'm learning use cgaffinetransformmakerotation can't work, have searched on web , can't find solution
i making clock, when test arrow doesn't rotate straight, moves @ same time.
-(void)tick{ nscalendar *calender = [[nscalendar alloc]initwithcalendaridentifier:nsgregoriancalendar]; nsuinteger units = nshourcalendarunit|nsminutecalendarunit|nssecondcalendarunit; nsdatecomponents *components = [calender components:units fromdate:[nsdate date]]; cgfloat secsangle = components.second*m_pi*2.0/60; self.secondhand.transform = cgaffinetransformmakerotation(secsangle); }
thanks in advance :)
first of all, when testing, use known value, m_pi/2.0
, instead of secsangle
anything.
second, keep in mind rotation around center of view/layer default. can change that, it's change it.
Comments
Post a Comment