代理中传多个参数值

前段时间一直在做后台开发,所以好长时间没搞过iOS了  ,不过最近又开启了iPad开发,,(毕竟是外包,公司要求做什么 那就做什么咯)

我一直都比较习惯在controller中写的代码很少,视图层全部都单独写出一个类,前段时间刚写了这个页面的封装,(当你看到这个页面不要惊慌,因为我这期的项目的页面全部都是这种的。。。)



好的,首先,因为这个页面本身是两个页面,上面的是一个页面 ,下面的部门节点是一个页面。然后公司要求融合到一个页面,所以这个页面的思路我就是放一个整体的scrollerView,然后上面放两个tableview,这个就可以实现了。

先说一下headerview的封装吧,,由于本人不擅长文字交流 ,那就直接代码好了。


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


    if (tableView.tag == 100) {


        TaskOneTableViewCell  *oneCell = [tableView dequeueReusableCellWithIdentifier:@"oneCell"];

        if (!oneCell) {

            oneCell = [[TaskOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"oneCell"];

            

        }

        oneCell.selectionStyle = UITableViewCellSelectionStyleNone;

        oneCell.Model = [[ModelStore shareInstance]getbiddersMentsData][indexPath.row];

        return oneCell;

            

    }else{

        qianchengTableViewCell *qiancell = [tableView dequeueReusableCellWithIdentifier:@"qianCell"];

        if (!qiancell) {

            qiancell = [[qianchengTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"qianCell"];

            

        }

        qiancell.actModel = [[ModelStore shareInstance]getactivitiesArrData][indexPath.row];

        return qiancell;

    }


    

}


- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{


    if (tableView.tag == 100 || tableView == self.TableView) {


        self.one = [[taskOne alloc]init];

        self.one.backgroundColor = COLOR_DOCK_COLOR;

        self.one.taskModel = [[ModelStore shareInstance]getTaskTakenData][section];

        

        return self.one;

        

    }else if (tableView.tag == 102 || tableView == self.QianchengTableView){

    

        self.twoheader = [[taskTwoHeader alloc]init];


        return self.twoheader;

    }

    

    return nil;

    

}

这个是在Controller里面写的代码,然后现在去封装的headerView看下代码

#import <UIKit/UIKit.h>

#import "Header.h"

@class Attachments;

@class taskFoot;


@protocol taskFootDelegate <NSObject>


//这就是代理中传多个值的代码

- (void)taskFootAcc:(taskFoot*)acc url:(NSString *)str;//查看附件


@end



typedef void(^ClickTaskOneControllerBlock)(NSString * contentMsg);


@interface taskFoot : UIView<UITextFieldDelegate>



@property(nonatomic,weakid<taskFootDelegate> delegate;


@property (nonatomic,copy) ClickTaskOneControllerBlock ClickTaskOneControllerBlock;


@property (nonatomic,strong)taskModel *taskModel;

@property (nonatomic,strong)Attachments *attModel;


- (void)updateData:(taskModel *)taskModel and:(Attachments *)nextmodel;



@property(nonatomic,strong)UILabel              *PRsave;//PR节约率

@property(nonatomic,strong)UILabel              *ProSave;//采购业绩率

@property(nonatomic,strong)UILabel              *BCsave;//Benchmark节约率

@property(nonatomic,strong)UILabel              *minPrice;//技术确认后最低价格

@property(nonatomic,strong)UILabel              *payMon;//付款条件

@property(nonatomic,strong)UILabel              *lawCon;//法律条款偏离情况

@property(nonatomic,strong)UILabel              *taskMark;//备注

@property(nonatomic,strong)UILabel              *approveIdea;//审批意见

@property(nonatomic,strong)UILabel              *accessory;//附件

@property(nonatomic,strong)UILabel              *comCom;//推荐供应商

@property(nonatomic,strong)UILabel              *platDate;//计划交货期

@property(nonatomic,strong)UITextField              *approveText;//审批意见



.m中

//view中按钮点击事件传参数,调用代理

- (void)accClick:(UIButton *)butt{


    if ([self.delegate respondsToSelector:@selector(taskFootAcc:url:)]) {

        [self.delegate taskFootAcc:self url:self.accURL];

    }


}


#pragma mark-textField代理

-(void)textFieldDidBeginEditing:(UITextField *)textField{

    

    [textField keyBoardDiss];

}

-(void)dealloc{

    

    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];

    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];

    

}


额,没了  大致就这么多。如有哪点不好请指出来,我虚心接受







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值