Swift 1

Source: Internet
Author: User

Cocoapods's use Podfile added: Platform:ios, ' 8.0 '
Target "Longyantv" do
Pod ' afnetworking ', ' ~> 3.1.0 ' end
To create a bridging file using OC code
2. Click the project-->targets-->build settings to find Swift Compiler, which has a: objective-c bridging Header, double-click the right margin will pop up the input box, Drag the header file you just created into the input box.

You can refer to the OC code by entering the <.h> file that you want to reference in the header.

Create Window Self.window = UIWindow (frame:UIScreen.main.bounds)
Self.window? BackgroundColor = Uicolor.white
Self.window? Rootviewcontroller = Mytabbarviewcontroller ()

Create Tabbar let FINDVC =findviewcontroller ()
Let Item1:uitabbaritem =uitabbaritem (title: "Discovery", Image:uiimage (named: "INDEX_BOTTOM_FX_DF")? Withrenderingmode (. alwaysoriginal), Selectedimage:uiimage (named: "Index_bottom_fx_sc")? Withrenderingmode (. alwaysoriginal))
Findvc.tabbaritem = Item1

Let LANMUVC =lanmuviewcontroller ()
Let Item2:uitabbaritem =uitabbaritem (title: "Column", Image:uiimage (named: "INDEX_BOTTOM_LM_DF")? Withrenderingmode (. alwaysoriginal), Selectedimage:uiimage (named: "Index_bottom_lm_sc")? Withrenderingmode (. alwaysoriginal))
Lanmuvc.tabbaritem = item2
Self.viewcontrollers = [FINDNANVC,LANMUNANVC]
Click the gesture let tap =uitapgesturerecognizer (target:self, Action: #selector (Camerabuttonaction))
Camerabutton.addgesturerecognizer (TAP)
Func camerabuttonaction () {

Print ("tapped")
Button Create let Camerabutton =uibutton ()
Camerabutton.frame =cgrect (x:width/2-35 * fitwidth, y:-0.5, width:70 * fitwidth,height:50)
Camerabutton.setimage (UIImage (named: "Bottom_pp_sc"), for:. Normal)
Self.view.addSubview (Camerabutton)
Camerabutton.addtarget (Self, Action: #selector (Camerabuttonaction), for:. Touchupinside)

Func camerabuttonaction () {

The creation of TableView

Import Uikit

var findtableview:uitableview!

Class Findviewcontroller:baseviewcontroller,uitableviewdelegate,uitableviewdatasource {

Overridefunc Viewdidload () {

Super.viewdidload ()

Self.view.backgroundColor = Uicolor.white

Self.title = "Discovery"

Findtableview =uitableview (Frame:cgrect (x:0,y:0,width:width,height:height), Style:.plain)

Self.view.addSubview (Findtableview)

Findtableview.delegate =self

Findtableview.datasource =self

Findtableview.backgroundcolor =uicolor.white


Func numberofsections (in Tableview:uitableview)-> Int {



Func TableView (_ Tableview:uitableview, numberofrowsinsection section:int)-> Int {



Func TableView (_ Tableview:uitableview, Cellforrowat indexpath:indexpath)-> UITableViewCell {

var cell = Tableview.dequeuereusablecell (withidentifier: "Reuse")

If cell ==nil {

Cell = UITableViewCell (style:.default,reuseidentifier: "Reuse")


Cell?. Textlabel? Text = "E"

Return cell!


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.

Tags Index: