iOS assumes that writing a hint-driven view of the picture can guide user behavior

Source: Internet
Author: User

First:



This uiview can write:

-(ID) initWithFrame: (CGRect) frame backimage: (uiimage*) Image msgStr: (nsstring*) txt txtcolor: (uicolor*) color{sel    f = [Super Initwithframe:frame];        if (self) {self.backgroundcolor = [uicolor Clearcolor];        _paopaoimage = image;        _txt = txt;            _color = color; } return self;} Only override Drawrect:if-perform custom drawing.//an empty implementation adversely affects performance during a    nimation.-(void) DrawRect: (cgrect) rect{cgcontextref context = Uigraphicsgetcurrentcontext ();    CGRect textrc = rect;    [_paopaoimage Drawinrect:rect];    Cgfontref Contextfont = Cgfontcreatewithfontname ((cfstringref) [Uifont Systemfontofsize:14].fontname];        Cfrelease (Contextfont);    Cgcontextsetfontsize (context, 14.0); Cgcontextsetfillcolorwithcolor (context, _color.    Cgcolor);    TEXTRC.ORIGIN.Y + = 11.0f; [_txt drawinrect:textrc Withfont:[uifont systemfontofsize:14] linebreakmode:nslinebreakbywordwrapping alignment: NstextalignmentcentER];} 

And then pops up:

-(void) showtipview{    cgrect rect = [[Homepageuimanager sharedinstance] categorytipviewframewhenlaunch];    popupmenu* menu = [[PopupMenu alloc] initwithframe:rect backimage:[uiimage imagenamed:@ "Change_search_tip.png"] msgStr : @ "open/close Panel" Txtcolor:[ccommon rgbcolorfromhexstring:@ "#ffffff" alpha:1.0f];        [Self.view Addsubview:menu];        Cabasicanimation *jumpanimation = [cabasicanimation animationwithkeypath:@ "TRANSFORM.TRANSLATION.Y"];    Jumpanimation.fromvalue = [NSNumber numberwithfloat:0.0f];    Jumpanimation.tovalue = [NSNumber numberwithfloat:8.0f];        jumpanimation.duration = 0.5f;//Animation duration    Jumpanimation.repeatcount = 10;//animation repeat times    jumpanimation.autoreverses = yes;//whether to take the initiative repeatedly    [Menu.layer addanimation:jumpanimation forkey:@ "Animatelayer"];}

The code can be downloaded in http://download.csdn.net/detail/baidu_nod/7629687

iOS assumes that writing a hint-driven view of the picture can guide user behavior

Related Article

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.