Swift Code Summary 8

Source: Internet
Author: User

1. Determine if the current controller is displayed:

// determines whether the current controller is displayed    Func iscurrentviewcontrollervisible (), Bool {        return (self.isviewloaded) && (( Self.view.window = nil)    }

2. Solve the white screen problem:

In fact, white screen problem is the controller's jump problem.

ifLet Tempnav = window?. Rootviewcontroller as?basenavigationcontroller{ forVcinchtempNav.childViewControllers.reversed () {if(VC = = TempNav.childViewControllers.last && vc.iskind (of:HomeViewController.self)) | |(VC= = TempNav.childViewControllers.last &&Vc.iskind (of:SumPayViewController.self)) {                     Break                }  Else ifVc.iskind (of:WaiterHomeViewController.self) {ifHHTSwitchGlobalData.shared.isBusinessModel {UIApplication.shared.pop2Business () }Else{UIApplication.shared.gotoRootViewController ()}} }        }

3. Data transfer model:

Note the type of the data model, otherwise it cannot be converted correctly.

4.NSNumber and NSString Conversion accuracy issues:


" %.2f " , Model.money.doubleValue)                 = ["code": Model.code,"ID": Model.id,"  Money" as [String:any]

5.Xib Set Uistackview, note that the child controls are set to an equal width, otherwise the layout is out of control.

Swift Code Summary 8

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.