如何在uicollection视图上添加文本字段? [英] How to add textfields on uicollection view?

查看:84
本文介绍了如何在uicollection视图上添加文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,在这里我必须显示一个这样的视图,我试图使用表格视图,但是我无法实现,此后,我决定借助collection view来实现它。发生了。我在这里感到沮丧是因为我的视图什么都不会发生。这些是视图中添加的文本字段,所有这些字段都是可单击的,任何人都可以帮助我,因为我比较新鲜,所以请帮助我。

i am doing a project ,where i have to show a view like this i tried to use table view ,but i was unable to implement ,after that i have decided to implement this with the help of collection view.but nothing fruitful happened .i get frustated here because nothing can happen with my view .these are the text fields added on the view and all are clickable,can anyone help me in this i am a fresher so please help me.

推荐答案

    //////////////////
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
    {
        if(section==0)
        {
            return self.view_header;
        }

        return nil;
    }

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
        CGFloat height =0.00;

        if(section==0)
        {
            height = 32;
        }     

        return height;
    }

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

        if(indexPath.section == 1)
        {
            return 51; 
        }
        else
        {
            return 35;
        }
    }



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

        if(self.flag_loadCompleted == TRUE)
        {
            return 1;
        }
        return 2;
    }


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

        if(section == 0)
        {
            return [self.arr_data count];
        }
        else if(section == 1)
        {
            return 1;
        }

        return 0;
    }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {    

    static NSString *CellIdentifier = @"MyTemplate";
    MyFinancialTemplate *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell == nil)
    {
        cell = [MyFinancialTemplate createNewTextCellFromNib];
    }    
    cell.index = indexPath.row;  
    if(indexPath.section == 0)
    {
        cell.index = indexPath.row;
        cell.flag_loader = FALSE;

        cell.selectionStyle = UITableViewCellSelectionStyleGray;
    }
    else
    {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.flag_loader = TRUE;
    }

    [cell LoadCell];

    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {   

}

这篇关于如何在uicollection视图上添加文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆