خرید بک لینک

Vote count: 0

Previous i am using Xcode 6.4 or below, In that I didn't notify this type issues. but now I am getting noticeable problems in Xcode 7.2 in related CGRectMake x,y Position.

    CGRect screenRect = [[UIScreen mainScreen] bounds];
    CGFloat screenWidth = screenRect.size.width;
    CGFloat screenHeight = screenRect.size.height;

    UIView *smallView=[[UIView alloc]initWithFrame:CGRectMake(screenWidth/2, screenHeight/2, 100, 100)];
    smallView.backgroundColor=[UIColor redColor];
    [self.view addSubview:smallView];
    NSLog(@"%f",smallView.frame.origin.x);// 137.500000

above snip code, the position of x & y not perfect. the below image is output . enter image description here

but if i add center=self.view.ceter It will come to center. the output is enter image description here

 smallView.center=self.view.center;

the problem is , in both case x & y position values same ,

  NSLog(@"%fn%fn%ff%f ",screenWidth/2,screenHeight/2,self.view.center.x,self.view.center.y);

Why they will show different result, how can i do without using center property. or Shall go for Autolayout .

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 26 اسفند 1394 ساعت: 19:32

صفحه بندی