Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 谁能识别这个物体?_Ios_Ios7 - Fatal编程技术网

Ios 谁能识别这个物体?

Ios 谁能识别这个物体?,ios,ios7,Ios,Ios7,大家好,我正在努力确定这个应用程序使用什么类型的对象来填充下面的字段,它会根据文本的数量自动调整大小,并且每个字段都没有滚动条,只适用于所有字段。我已经尝试了标签、文本视图,但没有成功 开发人员回答说,他使用“自定义UIVIEW”,你知道怎么做吗?谢谢 在我看来,它就像一个带有自定义单元格的应用程序,它们根据文本调整单元格高度。我使用此代码在我的应用程序中调整单元格高度: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtI

大家好,我正在努力确定这个应用程序使用什么类型的对象来填充下面的字段,它会根据文本的数量自动调整大小,并且每个字段都没有滚动条,只适用于所有字段。我已经尝试了标签、文本视图,但没有成功

开发人员回答说,他使用“自定义UIVIEW”,你知道怎么做吗?谢谢

在我看来,它就像一个带有自定义单元格的应用程序,它们根据文本调整单元格高度。我使用此代码在我的应用程序中调整单元格高度:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.questions.count == 0) return 44;
    CGFloat labelNeededHeight = [self.questions[indexPath.row][@"title"] sizeWithFont:[UIFont fontWithName:@"AvenirNext-Regular" size:19.0] constrainedToSize:CGSizeMake(self.view.frame.size.width - 68, 5000)].height;
    return MAX(labelNeededHeight, 44);
}
您需要将自己的值放入
constrainedToSize
参数中,
cSizeMake
中的第一个值是单元格中标签的宽度,第二个值(在我的例子中为5000)是单元格允许的最大高度。

在我看来就像是一个自定义单元格,它们根据文本调整单元格高度。我使用此代码在我的应用程序中调整单元格高度:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.questions.count == 0) return 44;
    CGFloat labelNeededHeight = [self.questions[indexPath.row][@"title"] sizeWithFont:[UIFont fontWithName:@"AvenirNext-Regular" size:19.0] constrainedToSize:CGSizeMake(self.view.frame.size.width - 68, 5000)].height;
    return MAX(labelNeededHeight, 44);
}

您需要将自己的值放入
constrainedToSize
参数中,
CGSizeMake
中的第一个值是单元格中标签的宽度,第二个值(在我的例子中为5000)是单元格允许的最大高度。

我的最佳猜测是,他们正在使用
UITableView
并根据每行中的文本动态计算
UITableView单元格的高度

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    // Calculate the height of the row, based on the string for this indexPath
}
在iOS 7上,您可以使用以下
NSString
方法来确定给定矩形中字符串的高度:

- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context;
在iOS 6及更早版本上,您可以使用:

- (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;

我的最佳猜测是,他们正在使用
UITableView
并根据每行中的文本动态计算
UITableViewCell
高度

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    // Calculate the height of the row, based on the string for this indexPath
}
在iOS 7上,您可以使用以下
NSString
方法来确定给定矩形中字符串的高度:

- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context;
在iOS 6及更早版本上,您可以使用:

- (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;

这是一个自定义UIView,您可以检查如何将其启用:
这是一个很好的教程。

这是一个自定义UIView,您可以检查如何在:
这是一个很棒的教程。

我将尝试这两种方法。。。让你知道。。TksI将尝试两者。。。让你知道。。TksI将尝试两者。。。让你知道。。ThxI将尝试两者。。。让你知道。。谢谢