I have created 10 buttons programmatically and set the titles in the button. Now i want to increase the button frame size dynamically,its depends on the text.
I given so
Very simple solution:
TestButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 8); [TestButton sizeToFit]; float width = TestButton.frame.size.width + 20; TestButton.frame = CGRectMake(TestButton.frame.origin.x, TestButton.frame.origin.y, width, 40);