I'm having a problem in displaying the control center in iOS, i've been searching for some docs regarding on this issue but couldn't find an answer. Is there a way, to make the control center appear by clicking a UIButton?.
Asked
Active
Viewed 268 times
1 Answers
0
You can apply constraints programatically to a specific UI element (link to iOS developer doc)
Sample code of this eg.:
// Center horizontally
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:viewToBeCentered
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
// Center vertically
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:viewToBeCentered
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0.0]];
You can include this code into your button's action code.
Hope this helps to achieve the desired effect!

nzs
- 3,252
- 17
- 22
-
What he asked? and what you answered? – Anil Varghese Dec 11 '14 at 07:47
-
@Anil I asked how to display the control center by click a uibutton – Aldrin Equila Dec 11 '14 at 08:07
-
Sorry.. i miss understood your question @AldrinEquila – Anil Varghese Dec 11 '14 at 08:19
-
It's ok @anil. No problem – Aldrin Equila Dec 11 '14 at 08:31