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
Post a Comment