这是什么原因呢?
-(id)initWithTextFild:(UITextField *)_txtFild
{
self=[super init];
if(self){
txtFild=_txtFild;
// [txtFild resignFirstResponder];
}
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
//初始化tableview的数据
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self refreshData:[self->txtFild text]];
}
-(void) refreshData:(NSString *) text
{
datalist = nil;
datalist = [[NSMutableArray alloc] init];
NSRange range=[text rangeOfString:@"@"];
prefix=[text substringToIndex:range.location];
suffixPrefix=[text substringFromIndex:range.location];
NSString * suffixStr=[NSStringlocalizedStringWithFormat:ILEAD_STRING_EMAIL_SUFFIX,@"email suffix"];
NSArray * suffixList=[suffixStr componentsSeparatedByString:@";"];
for (NSString * suffix in suffixList) {
if([suffix hasPrefix:suffixPrefix]){
[datalist addObject:[NSString stringWithFormat:@"%@%@",prefix,suffix]];
}
}
float hg =81;
if([datalist count]<3){
hg=[datalist count]*27;
}
float x=txtFild.frame.origin.x;
float y=txtFild.frame.origin.y;
float width=txtFild.frame.size.width;
float height=txtFild.frame.size.height;
[self.view setFrame:CGRectMake(x+2, y+height+8, width-4, hg)];
}
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
if ([datalist count]>0)
{
tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
}
return [datalist count];
}
-(UITableViewCell)tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellWithIdentifier = [NSString stringWithFormat:@"Cell%d", indexPath.row];//这里按照每个row来标
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellWithIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellWithIdentifier];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [datalist objectAtIndex:row];
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:16];
return cell;
}
//设置内容缩进
return 0;
}
//设置cell的行高
{
return 27;
}
//当选择指定的cell时,显示选择的内容
{
txtFild.text = [[NSString alloc] initWithFormat:@"%@",[datalist objectAtIndex:[indexPath row]]];
[self.view removeFromSuperview];
}
-(BOOL) tableView:(UITableView )tableView canEditRowAtIndexPath:(NSIndexPath )indexPath
{
return NO;
}
{ return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
<script> function f1(){ var div_obj=document.getElementById("divObj"); var input_h=document.getElementById("radio_009").offsetHeight; div_obj.scrollTop= input_h*9; } f1(); </script>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。