objective c - Getting Screen width and height -


this question has answer here:

im creating new subview in xcode using cgrectmake. can fine. make size of new view 10 pixels less screen width. work java , use screen.width-10 this. objc in xcode i'm not sure how , couldn't find info needed. have far creates box on button tap change width 100 screen width - 10.

//info button -(ibaction) buttontapped:(id)sender {     // create new uiview     uiview *newview = [[uiview alloc] initwithframe:cgrectmake(10,10,100,100)];      // something, e.g. set background color red     newview.backgroundcolor = [uicolor redcolor];      // add new view subview existing 1 (e.g. self.view)     [self.view addsubview:newview];      // release newview -addsubview: retain     [newview release]; } 

thanks in advance.

float height = [[uiscreen mainscreen] bounds].size.height  float width = [[uiscreen mainscreen] bounds].size.width 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -