美文网首页
iOS ETH钱包助记词开发

iOS ETH钱包助记词开发

作者: 卡哇伊小王子 | 来源:发表于2018-12-27 14:56 被阅读0次

UI今天给了个需求,把乱序的单词拼成一句话,如下图:

哈哈,这个的确就是当时的想法,不要怂就是干~

那就来试试吧,话不多说,直接上代码:

-(UITableView*)tagsView{

    if (!_tagsView){

        _tagsView =[[UITableView alloc]initWithFrame:CGRectMake(0, 239, kScreenWidth, kScreenHeight/2-60) style:UITableViewStylePlain];

        _tagsView.alwaysBounceVertical = YES;

        _tagsView.delegate=self;

        _tagsView.dataSource=self;

    }

    return _tagsView;

}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {

    return self.groups.count;

}

- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {

    EFTagGroupItem*group =self.groups[section];

    returngroup.data.count;

}

- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {

    if(indexPath.section==0) {

        EFHobbyCell *cell = [tableView dequeueReusableCellWithIdentifier:hobbyCell];

        cell.tagList=self.tagList;

        returncell;

    }

    EFGroupItem*group =self.groups[indexPath.section];

    EFTagGroupItem*tagGroup = group.data[indexPath.row];

    EFTagGroupCell *cell = [tableView dequeueReusableCellWithIdentifier:tagGroupCell forIndexPath:indexPath];

    cell.collectionView.delegate = self;

    cell.tagGroup= tagGroup;

    returncell;

}

- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath

{

    if(indexPath.section==0) {

        return _tagList.tagListH;

    }

    EFGroupItem*group =self.groups[indexPath.section];

    EFTagGroupItem*tagGroup = group.data[indexPath.row];

    returntagGroup.cellH;

}

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section

{

    return 0;

}

#pragma mark - UICollectionViewDelegate

- (void)collectionView:(UICollectionView*)collectionView didSelectItemAtIndexPath:(NSIndexPath*)indexPath

{

    EFTagCell*cell = (EFTagCell*)[collectionViewcellForItemAtIndexPath:indexPath];

    EFTagsItem*item = cell.item;

    item.isSelected = !item.isSelected;

    cell.item= item;

    NSString*tagStr = cell.tagLabel.text;

    if(item.isSelected) {

        [self.tagListaddTag:tagStr];

        [self.selectTagDictsetObject:cellforKey:tagStr];

        [self.selectTagArraddObject:tagStr];

    }else{

        [self.tagListdeleteTag:tagStr];

        for(inti =0;i<_selectTagArr.count;i++){

            if([_selectTagArr[i]isEqualToString:tagStr]){

                [_selectTagArrremoveObjectAtIndex:i];

                i--;

            }

        }

    }

    [self.tagsView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];

}

很简单的需求,有不懂的可以线下交流 wx:dwl-1591293009

相关文章

网友评论

      本文标题:iOS ETH钱包助记词开发

      本文链接:https://www.haomeiwen.com/subject/afirlqtx.html