Basic use of IOS Uiactionsheet

Source: Internet
Author: User
<span id="Label3"></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><span style="color:rgb(192,0,0);">Ns_class_deprecated_ios (2_0, 8_3, "uiactionsheet is DEPRECATED. Use Uialertcontroller with a preferredstyle of Uialertcontrollerstyleactionsheet instead ") __tvos_prohibited</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><span style="color:rgb(192,0,0);"></span><span style="color:rgb(68,68,68);font-family:‘Droid Serif‘, Georgia, ‘Times New Roman‘, STHeiti, serif;font-size:14px;background-color:rgb(255,255,255);">After iOS8, Uiactionsheet (and their respective delegate protocols) have been deprecated and <span style="font-family:Menlo;font-size:18px;background-color:rgb(255,255,255);">replaced with uialertcontroller, which is 2 ways before and after IOS8:</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,70,71);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">Double Version = [[uidevice currentdevice].systemversion doublevalue];//</span> <span style="color:rgb(0,0,0);background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">Determine the system Version. </span><br></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:menlo;color:rgb (255,255,255);">< Span style= "color:rgb (0,0,0); Background-color:rgb (255,255,255);" > <span style="color:rgb (222,56,166); background-color:rgb (255,255,255);">if </span> (version>=<span style="color:rgb (139,135,255); Background-color:rgb (255,255,255);">8.0f </span>) { </p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:menlo;color:rgb (0,177,255);">< Span style= "color:rgb (0,0,0); Background-color:rgb (255,255,255);" ><span style="background-color:rgb (255,255,255); >     </span> Uialertcontroller<span style=" background-color:rgb (255,255,255); "> *alertcontroller = [</span> Uialertcontroller<span style="background-color:rgb (255,255,255);"> </span> Alertcontrollerwithtitle<span style="background-color:rgb (255,255,255);">:@ "</span> <span style=" Background-color:rgb (255,255,255); line-height:normal;font-family: ' Heiti SC light '; > hint </span> <span style= " background-color:rgb (255,255,255);" "" < span> message<span style="background-color:rgb ( 255,255,255); ">:nil </span> preferredstyle<span style="background-color:rgb (255,255,255);" ">: </span> Uialertcontrollerstyleactionsheet<span style="background-color:rgb (255,255,255);" ]; < span> </span> </span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:menlo;color:rgb (0,177,255);">< Span style= "color:rgb (0,0,0); Background-color:rgb (255,255,255);" ><span style="background-color:rgb (255,255,255); >     [alertcontroller </span> addaction<span style = " background-color:rgb (255,255,255);">:[</span> Uialertaction<span style="background-color:rgb (255,255,255);"> </span> actionwithtitle<span style=" Background-color:rgb (255,255,255); ">:@ "</span> <span style=" background-color:rgb (255,255,255); line-height:normal;font-family: ' Heiti SC light '; "> OK </span> <span style="background-color:rgb (255,255,255);" "< span> style<span style=" background-color:rgb (255,255,255); "> : </span> uialertactionstyledefault<span style="background-color:rgb (255,255,255);"> </span> handler<span style=" Background-color:rgb (255,255,255); ">:^ (</span> Uialertaction<span style="background-color:rgb (255,255,255);" * _nonnull action) {< span> </span> </span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="color:rgb(0,177,255);background-color:rgb(255,255,255);">NSLog</span> (<span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">@ "</span> <span style="color:rgb(255,70,71);background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">OK</span> <span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">"</span>);</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">}]];</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:menlo;color:rgb (0,177,255);">< Span style= "color:rgb (0,0,0); Background-color:rgb (255,255,255);" ><span style="background-color:rgb (255,255,255); >     [alertcontroller </span> addaction<span style = " background-color:rgb (255,255,255);">:[</span> Uialertaction<span style="background-color:rgb (255,255,255);"> </span> actionwithtitle<span style=" Background-color:rgb (255,255,255); ">:@ "</span> <span style=" background-color:rgb (255,255,255); line-height:normal;font-family: ' Heiti SC light '; "> Cancel </span> <span style="background-color:rgb (255,255,255);" "< span> style<span style=" background-color:rgb (255,255,255); "> : </span> uialertactionstyledestructive<span style="background-color:rgb (255,255,255);"> </span> handler<span style="background-color:rgb (255,255,255);">:^ (</span> Uialertaction<span style="background-color:rgb (255,255,255);" * _nonnull action) {< span> </span> </span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="color:rgb(0,177,255);background-color:rgb(255,255,255);">NSLog</span> (<span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">@ "</span> <span style="color:rgb(255,70,71);background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">cancel</span> <span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">"</span>);</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">}]];</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">[ </span>self presentviewcontroller<span style="background-color:rgb(255,255,255);">: Alertcontroller </span>animated<span style="background-color:rgb(255,255,255);">: YES </span>completion<span style="background-color:rgb(255,255,255);">: nil];</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(222,56,166);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(222,56,166);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">}</span>Else<span style="background-color:rgb(255,255,255);">{</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">#pragma clang diagnostic push</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">#pragma clang diagnostic ignored <span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">"-wdeprecated-declarations"</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">     </span></span>Uiactionsheet<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">*sheetview = [[</span></span>Uiactionsheet<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"> </span></span>Alloc<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">] </span></span>Initwithtitle<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">:@"</span></span><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;"><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">Tips</span></span><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">" </span></span>Delegate<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">:</span> self</span>Cancelbuttontitle<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">: Nil</span></span>Destructivebuttontitle<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">: Nil</span></span>Otherbuttontitles<span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">:@"</span></span><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;"><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">Determine</span></span><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">",@"</span></span><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;"><span style="background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">Cancel</span></span><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">", nil];</span></span></span></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">#pragma clang diagnostic pop</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,177,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">Sheetview.</span> Actionsheetstyle<span style="background-color:rgb(255,255,255);"> = </span>Uiactionsheetstyledefault<span style="background-color:rgb(255,255,255);">;</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">[sheetview <span style="color:rgb(0,177,255);background-color:rgb(255,255,255);">showinview</span>:<span style="color:rgb(222,56,166);background-color:rgb(255,255,255);"></span>self. <span style="color:rgb(0,177,255);background-color:rgb(255,255,255);">View</span>];</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">}</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(235,144,90);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">#pragma mark Actionsheet_delegate <span style="color:rgb(0,0,0);background-color:rgb(255,255,255);line-height:normal;font-family:‘Heiti SC Light‘;">Click events</span></span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:menlo;color:rgb (255,255,255);">< Span style= "color:rgb (0,0,0); Background-color:rgb (255,255,255);" >-(<span style="color:rgb (222,56,166); background-color:rgb (255,255,255);">void </span>) actionsheet: (<span style="color:rgb (0,177,255); Background-color:rgb (255,255,255);">uiactionsheet </span> *) actionsheet clickedbuttonatindex: (<span style="color:rgb (0,177,255); Background-color:rgb ( 255,255,255); ">nsinteger </span>) buttonindex <span style="color:rgb (235,144,90); background-color:rgb (255,255,255);">NS_ Deprecated_ios </span> (<span style="color:rgb (139,135,255); background-color:rgb (255,255,255); >2 </span> _0, <span style= " color:rgb (139,135,255); background-color:rgb (255,255,255);">8 </span> _3) <span style="color:rgb (235,144,90); background-color:rgb (255,255,255);">__tvos_prohibited </span> { </p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);"><span style="color:rgb(0,177,255);background-color:rgb(255,255,255);">NSLog</span> (<span style="color:rgb(255,70,71);background-color:rgb(255,255,255);">@ "%@"</span>,<span style="color:rgb(139,135,255);background-color:rgb(255,255,255);">@ (</span>buttonindex<span style="color:rgb(139,135,255);background-color:rgb(255,255,255);">)</span>);</span></p></p><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><p style="margin-top:0px;margin-bottom:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255);">}</span></p></p><p><p><br></p></p><p><p>This article is from the "11204872" blog, please be sure to keep this source http://11214872.blog.51cto.com/11204872/1752370</p></p><p><p>Basic use of IOS Uiactionsheet</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.