UIView functions similar to Alertview
I need to add 3 buttons and one textfield in an alertview.
It is not possible so in the place of alertview i place create a view with 3 buttons and one textfield In the InterfaceBuilder.
Where ever i need this simply i call like
additionalView.center = self.view.center;
[self.view addsubview:additionalView];
it displays fine, It adds over the existing view,thats fine but when ever i click any button or textfield that all are al开发者_StackOverflow社区so working.
But i need additionalview function same as UIAlertview.
How can i done this,can any one pls help me.
Thank u in advance.
UIView has a property called 'center' which you can set - so you can assign your subview the center of its parent view, which will place it directly in the middle:
additionalView.center = self.view.center;
[self.view addSubview:additionalView];
...will display the view in the middle (calculated according to its frame).
@MaheshBabu above answer of lxt's is correct if u wanna add a textfield and 3 buttons in a additionalView ,if u want that view to be at center then u have to give the center to the view to a additionalView
But u wanna do it through a UIAlertView then i suggest u to follow this link..http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html
Hope this may help u!!
精彩评论