Wednesday, July 25, 2012

Working with Action Sheets


Hi,

I got the chance to work on the action sheets.
I created a sample app before going ahead on my project.

Here is what i tried in my sample.
May be someone can be helped with this.

Here you go.....

1) Start with creating a Single View Based Application via 
    Xcode --> New --> Project --> Single View based App



2) Now Open the storyboard, and add a label and a button. clicking on this button the action sheet will be displayed.



3) Now Create an IBAction in .h file and connect the Button's "TouchUpInside"method with the IBAction.





4) Now open the .m file and inside the button's click method create an action sheet.



An important Edit for perfect display of action sheet in landscape mode
    [actionSheet showInView:[self.navigationController view]];
5) Once the action sheet is created we need to add its delegate method also so that we can perform some actions on the buttons added in the action sheet. All the buttons added in the action sheet are identified by their indices.



6) When you RUN the application

7) Click on the "Show Action Sheet" button, You can see the below output.When any button gets clicked in the action sheet then the corresponding delegate method gets fired. We have placed NSLogs inside the method to identify the particular clicks.



Enjoy.....
:)









2 comments: