见文档:
Apple Watch Programming Guide: Tables
WatchKit Framework Reference: WKInterfaceTable
例如,让我们创建具有两种行类型的表:
> headerRowType
> detailRowType
#define type1 @"headerRowType"#define type2 @"DetailRowType"// You also must create two classes: headerRowType and DetailRowType - controllers for these two types// preparing datasource: fill rowTypes and tableObjectsNSArray* rowTypes = @[type1,type2,type1,type2]; // types for table with 1 header cell and 3 detail cells in first "section",1 header and 2 detail cells in second "section"// set types! self.sometable - WKInterfacetable,associated with table in UI[self.sometable setRowTypes:rowTypes];for (NSInteger i = 0; i < rowTypes.count; i++){ Nsstring* rowType = self.rowTypes[i]; if ([rowType isEqualToString:type1]) { // create headerRowType object and fill its propertIEs. There you also can parse any data from main iPhone app. headerRowType* type1Row = [self.sometable rowControllerAtIndex:i]; // type1Row.property1 = ...; } else { DetailRowType* type2Row = [self.sometable rowControllerAtIndex:i]; // type2Row.property1 = ...; // type2Row.property2 = ...; }}
完成!发挥想象力,创造更复杂的数据结构.
总结以上是内存溢出为你收集整理的ios – 如何在WKInterfaceTable中创建节全部内容,希望文章能够帮你解决ios – 如何在WKInterfaceTable中创建节所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)