Lan Yi iOS Real-combat music player

Source: Internet
Author: User

Today, Liu Guobin teacher taught a demo of the actual combat, write music player

1, if in the Viewcontroller jump to other pages, another viewcontroller is storyboard dragged out, the initialization of the page needs to use Self.stroy re-call method, Instantiateviewcontrollerwithidentifier

2, but if the other page is not Viewcontroller and then jump to another page, the page is also used Stroyboard dragged out, then use Uistoryboard through their own mainstoryboard mark "Main" First, create an object to initialize another page with this object.

Uistoryboard *storyboard = [Uistoryboard storyboardwithname:@ "Main" bundle:nil];

Macro definition automatically gets the size of the screen

#define Screen_size [UIScreen mainscreen].bounds.size

Feature implementation jumps from the first page to Tabbarcontroller

@implementation Viewcontroller

-(void) Viewdidload {

[Super Viewdidload];

Uiscrollview *sc=[[uiscrollview Alloc]initwithframe:[uiscreen Mainscreen].bounds];

Sc.pagingenabled=yes;

for (int i=0; i<5; i++) {

Uiimageview *iv=[[uiimageviewalloc]initwithframe:cgrectmake (i*screen_size.width, 0, SCREEN_SIZE.width, SCREEN_ Size.Height)];

Iv.image=[uiimage imagenamed:[nsstringstringwithformat:@ "Welcome_3.0_%d.jpg", i+1]];

[SC Addsubview:iv];

}

CGRect bnfram=cgrectmake (0, 0, screen_size.width, screen_size.height);

UIButton *bn=[[uibutton Alloc]initwithframe:bnfram];

[Bn addtarget:self Action: @selector (MOO) forcontrolevents:uicontroleventtouchupinside];

[SC Addsubview:bn];

sc.delegate=self;

Considering the problem of screen size adaptation, the content of this contentsize takes a dynamic

Sc.contentsize=cgsizemake (5*screen_size.width, 667);

[Self.view ADDSUBVIEW:SC];

}

-(void) moo{

TabONe *ta1=[tabone New];

Ta1.view.backgroundcolor=[uicolor colorwithred:.5 green:.5 blue:.6 alpha:.7];

[Email protected] "Forgive me for my life's Bohemian";

Uinavigationcontroller *nv1=[[uinavigationcontrolleralloc]initwithrootviewcontroller:ta1];

[Email protected] "My Music";

Nv1.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_item_my_music.png"];

Tabtwo *ta2=[tabtwo New];

Ta2.view.backgroundcolor=[uicolor Redcolor];

[Email protected] "spicy dick";

Uinavigationcontroller *NV2=[[UINAVIGATIONCONTROLLERALLOC]INITWITHROOTVIEWCONTROLLER:TA2];

[Email protected] "network";

Nv2.tabbaritem.image=[uiimage imagenamed:@ "tabbar_item_selected"];

Tabthree *ta3=[tabthree New];

[Email protected] "No culture, reading";

Ta3.view.backgroundcolor=[uicolor Bluecolor];

Uinavigationcontroller *NV3=[[UINAVIGATIONCONTROLLERALLOC]INITWITHROOTVIEWCONTROLLER:TA3];

[Email protected] "local";

Nv3.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_item_store_selected.png"];

Tabfour *ta4=[tabfour New];

[Email protected] "How painful the comprehension";

Ta4.view.backgroundcolor=[uicolor Greencolor];

Uinavigationcontroller *NV4=[[UINAVIGATIONCONTROLLERALLOC]INITWITHROOTVIEWCONTROLLER:TA4];

[Email protected] "more";

Nv4.tabbaritem.image=[uiimage imagenamed:@ "Tabbar_item_more.png"];

Uitabbarcontroller *tabbar=[[uitabbarcontroller Alloc]init];

[Email protected] [NV1,NV2,NV3,NV4];

[Self Presentviewcontroller:tabbar animated:yes completion:nil];

}

Lan Yi iOS Real-combat music player

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.