#从零開始学Swift

swift selector写法

  #selector(xiuGaiNote(_:))    @objcfuncxiuGaiNote(_note:Notification)->Void{    letdic=note.userInfo  &nbs...
代码星球 ·2020-09-11

swift menuviewcontroller没有显示出来

//  funccanBecomeFirstResponder()->Bool{//    returntrue//  }  overridevarcanBecomeFirstResponder:Bool{&nbs...

swift开发笔记19

 、、   [UIApplicationsharedApplication].networkActivityIndicatorVisible=YES; 、、Set()union()...
代码星球 ·2020-09-11

swift开发笔记04

     letnow=Date()    letgregorian=Calendar.init(identifier:Calendar.Identifier.gregorian)    l...
代码星球 ·2020-09-10

swift开发笔记15

swift开发笔记15//swift中的String和OC中的NSString转换extensionString{ varconvert:NSString{return(selfasNSString)}}    varbackgroundColor:UIColor=UI...
代码星球 ·2020-09-10

swift开发笔记14

dotOne.transform=CGAffineTransform.init(scaleX:0.01,y:0.01) // OptionSet,可以多选,例如[.repeat,.autoreverse]UIView.animate(withDuration:0.6,delay:0.0,option...
代码星球 ·2020-09-10

swift开发笔记13

letv:String!=str    //疑问,后面加!,什么意思?表示这个常量一定有值https://www.zhihu.com/question/36448325语法糖funcdoSomething(str:String?){ifletv=str{//usevtodosomething}} funcdo...
代码星球 ·2020-09-10

swift开发笔记11

//注意判断条件, overridefuncprepare(forsegue:UIStoryboardSegue,sender:Any?){   ifletcell=senderas?UICollectionViewCell,   letindexP...
代码星球 ·2020-09-10

swift开发笔记06

//自定义cellclassCell:UITableViewCell{     @IBOutletweakvarfenLei:UILabel!  @IBOutletweakvartangGuoMing:UILabel!  &nbs...
代码星球 ·2020-09-10

swift开发笔记10

//cell的经典配置   varmodel:Interest!{    didSet{      updateUI()    } &nbs...
代码星球 ·2020-09-10

swift开发笔记09

//类的扩展publicextensionUIColor{  convenienceinit(r:Int,g:Int,b:Int,a:CGFloat){    self.init(red:CGFloat(r)/255,green:CGFloat(g)/255,...
代码星球 ·2020-09-10

swift开发笔记07

//监听通知NotificationCenter.default.addObserver(self,selector:#selector(LibraryAPI.downloadImage(_:)),name:NSNotification.Name(rawValue:downloadImageNotification),...
代码星球 ·2020-09-10

swift开发笔记08

 swift中的XML解析,工具类:FeedParser() //在主线程刷新UIDispatchQueue.main.async{} //tableView自动布局tableView.beginUpdates()tableView.endUpdates() //guardgua...
代码星球 ·2020-09-10

swift开发笔记05

rowHeightNotethatifyoucreateaself-sizingcellinInterfaceBuilder,thedefaultrowheightischangedtothevaluesetinInterfaceBuilder.Togettheexpectedself-sizingbehaviorfo...
代码星球 ·2020-09-10

-Swift.h not find

亲测成功。随便新建一个swift文件,xcode问是否生成xxx-Bridging-Header.h文件,点YES。再编译,问题解决。 Bydefault,thegeneratedheadercontainsinterfacesforSwiftdeclarationsmarkedwiththe pu...
代码星球 ·2020-09-10
首页上一页12345...下一页尾页