自定义uitableviewcell 内部添加控件 坐标错误
//
// UserInfoTableViewCell.m
// PhilisenseMultimediaMeeting
//
// Created by flx on 13-7-9.
// Copyright (c) 2013年 flx flx. All rights reserved.
//
#import "UserInfoTableViewCell.h"
#define BORLDER_BACKIMAGE @"cell_border.png" //边框背景图片
#define BORLDER_HEIGHT 1.0 //边框高度
@implementation UserInfoTableViewCell
@synthesize userNameLabel,ipLabel;
@synthesize topImageView,bottomImageView,iconImageView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
//设置上下边框
UIImageView *topBorlder = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, BORLDER_HEIGHT)];
topBorlder.image = [UIImage imageNamed:BORLDER_BACKIMAGE];
self.topImageView = topBorlder;
[self addSubview:topBorlder];
//设置下边框
UIImageView *bottomBorlder = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.frame.origin.y + self.frame.size.height - 1, self.frame.size.width, 1)];
bottomBorlder.image = [UIImage imageNamed:BORLDER_BACKIMAGE];
self.bottomImageView = bottomBorlder;
[self addSubview:bottomBorlder];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
上面设置下边框的时候错误,因为UITableViewCell 默认高度为44.00
我在UITableView 的UITableViewDataSource,UITableViewDelegate 实现文件里面
//row 的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60.0f;
}
返回的是60,这样导致 上面cell内部的设置的下边框的y坐标为44,而不是60.这个我该如何修改哪
// UserInfoTableViewCell.m
// PhilisenseMultimediaMeeting
//
// Created by flx on 13-7-9.
// Copyright (c) 2013年 flx flx. All rights reserved.
//
#import "UserInfoTableViewCell.h"
#define BORLDER_BACKIMAGE @"cell_border.png" //边框背景图片
#define BORLDER_HEIGHT 1.0 //边框高度
@implementation UserInfoTableViewCell
@synthesize userNameLabel,ipLabel;
@synthesize topImageView,bottomImageView,iconImageView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
//设置上下边框
UIImageView *topBorlder = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, BORLDER_HEIGHT)];
topBorlder.image = [UIImage imageNamed:BORLDER_BACKIMAGE];
self.topImageView = topBorlder;
[self addSubview:topBorlder];
//设置下边框
UIImageView *bottomBorlder = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.frame.origin.y + self.frame.size.height - 1, self.frame.size.width, 1)];
bottomBorlder.image = [UIImage imageNamed:BORLDER_BACKIMAGE];
self.bottomImageView = bottomBorlder;
[self addSubview:bottomBorlder];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
上面设置下边框的时候错误,因为UITableViewCell 默认高度为44.00
我在UITableView 的UITableViewDataSource,UITableViewDelegate 实现文件里面
//row 的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60.0f;
}
返回的是60,这样导致 上面cell内部的设置的下边框的y坐标为44,而不是60.这个我该如何修改哪
...全文
相关推荐
可以通过不同的坐标显示菜单,cell也不用单独获取坐标.zip
可以在cell上弹出的菜单,不用获取cell坐标,直接引入这个view就可以弹出菜单,很好用,拓展性也很强
iOS 工程师面试题
对于刚参加工作的iOS开发者在公司面试之前温习一下以前所学的知识,那是极好滴。
Swift-BubbleView(优惠冒泡动画).zip
Swift-BubbleView(优惠冒泡动画).zip
IOS源码ZKRevealingTableCellViewforiOS-1
IOS源码ZKRevealingTableCellView for iOS-1
IOS源码IOS应用源码之自制iPhoneDataGrid数据列表组件,支持行列锁定Grid
IOS源码IOS应用源码之自制 iPhone DataGrid 数据列表组件,支持行列锁定Grid


