Tag: 高度

Swiftdynamic表格单元格高度

我有tableview原型单元格,在我有imageview和一些文本下的单元格。 文本标签在原型单元中是一条线,但有时它不止一行,我在服务器调用之后将数据加载到表视图。 故事板行中的标签设置为0,换行符换行。 我也试过http://candycode.io/automatically-resizing-uitableviewcells-with-dynamic-text-height-using-auto-layout/ 但没有效果。 如果我在UITableView中使用UITableView的自动布局dynamic单元格布局和variables行高度一切正常,因为标签文本是预定义的,但我从服务器加载数据,我重新加载API调用后的tableView,然后标签只是一条线。

iOS CoreLocation海拔高度

在iOS 4.0之前, CoreLocation正确报告高度,现在总是报告为0英尺。 -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation *)oldLocation { NSString *tLatitude = [NSString stringWithFormat:@"%3.5f", newLocation.coordinate.latitude]; NSString *tLongitude = [NSString stringWithFormat:@"%3.5f", newLocation.coordinate.longitude]; /* the following returns 0 */ NSString *tAltitude = [NSString stringWithFormat:@"%i", newLocation.altitude]; /* theres more code, but it's not relevant, and this worked prior to iOS 4.0*/ [manager stopUpdatingLocation]; } 不在设备和模拟器上工作,是否有其他人遇到这个问题?

更改UITableView行高而不closures键盘

我有一个UITableViewCell里面的TextView。 TextView中的文本可以在那里编辑。 TextView垂直增长和缩小,取决于文本包含的行数。 到目前为止,我还没有find一个可能让包含TextView的行dynamic增长和缩小。 [tableView reloadData]; 要么 [tableView reloadRowsAtIndexPaths: withRowAnimation:]; 不工作,因为他们每次改变都会closures键盘。 有没有办法改变UITableView中的单个行的高度而不closures键盘?

以编程方式更改高度限制

我想以编程方式更改UITextView的高度约束,所以我将约束设置为我的控制器中的sockets,如下所示: @property (strong, nonatomic) IBOutlet NSLayoutConstraint *descriptionHeightConstraint; 要改变它我做到以下几点: self.descriptionHeightConstraint.constant = self.description.contentSize.height; 这个作品,如果我在viewDidAppear做,但这样做的问题是,我可以看到高度变化后,显示视图是不是非常用户友好,所以我试图做viewWillAppear但没有在那里工作,高度doesn'改变。 更改约束后调用setNeedsUpdateConstraints也不起作用。 为什么在viewDidAppear工作,而不是在viewWillAppear? 任何解决方法? 提前致谢!

iOS 11 – 无法更改导航栏高度

我在一个应用程序上工作,我刚刚升级到Xcode 9 / Swift 4,并将我的iPhone升级到了iOS 11.当我安装了iOS 11时,应用程序已经安装好了,并且在我从Xcode运行它之前,所有的东西都没有问题。 现在我坚持默认的NavBar高度。 我用来更改高度的代码不再有效: class CustomNavControllerVC: UINavigationController { let navBarHeight : CGFloat = 64.0 let navbarBackButtonColor = UIColor(red: 247/255, green: 179/255, blue: 20/255, alpha: 1) override func viewDidLoad() { super.viewDidLoad() print("CustomNavControllerVC > viewDidLoad") } override func viewDidLayoutSubviews() { print("CustomNavControllerVC > viewDidLayoutSubviews") super.viewDidLayoutSubviews() navigationBar.frame.size.height = navBarHeight navigationBar.tintColor = navbarBackButtonColor } override […]

获取UIWebView内容的高度

我有一个使用loadHtmlString函数加载数据的uiwebview。事情是我从SQLite数据库加载数据,每当我加载不同的string不同的长度,当然networking视图获得不同的高度。 现在我需要知道每一次的uiwebview的确切的高度,以加载一个imageView下的webView。 我努力了 – (void)webViewDidFinishLoad:(UIWebView *)aWebView { CGRect frame = aWebView.frame; frame.size.height = 1; aWebView.frame = frame; CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero]; frame.size = fittingSize; aWebView.frame = frame; NSLog(@"Size: %f, %f", fittingSize.width, fittingSize.height); } 但我总是得到相同的结果。 我需要知道如何dynamic获取每次加载的Web视图的高度。 谢谢

下载图像时调整UITableViewCell高度

我正在使用UIImageView+AFNetworking类别asynchronous图像加载。 一切工作正常,但我已经尝试了几件事情,并根据下载的图像调整单元格的高度不成功。 我想图像适合单元格的宽度,但调整高度,但我不知道如何做到这一点。 我已经尝试重新加载图像下载的行,但只是导致cellForRowAtIndexPath再次启动,并再次设置一切,等等几乎是一个recursion。 我正在计算新的图像大小差异,并将其存储在NSMutableArray ,然后重新加载在UIImageView的setImageWithURLRequest:placeholderImage:success:成功块中的行setImageWithURLRequest:placeholderImage:success: 我在heightForRowAtIndexPath得到了几行的正确高度,但是,表开始变得怪异,一切都在叠加等等。 有任何想法吗? 谢谢! 编辑 我最终使用了Ezeki的答案。 我也写了一个关于这个话题的post,并且使用这个技术做了一个示例应用程序。 看看这里 。

更改UINavigationBar高度

有人能告诉我如何改变导航栏的高度? 这是我迄今为止: CGFloat navBarHeight = 10; self.navigationController.navigationBar.frame.size.width = navBarHeight;

dynamic更改UITableView高度

我想改变我的tableview从另一个viewcontroller的高度基于其单元格的高度,因为它们是dynamic的。 这是否可能? 谢谢 加上: 我基本上有一个UserProfileViewController在屏幕的一半上有一个containerview。 在那里我添加了不同的其他视图控制器: 在墙上的button,这是我如何添加视图控制器和它的后续tableview: – (IBAction)wallButtonPressed:(id)sender { //Check if there is an instance of the viewcontroller we want to display. If not make one and set it's tableview frame to the container's view bounds if(!_userWallViewController) { self.userWallViewController = [[WallViewController alloc] init]; // self.userWallViewController.activityFeedTableView.frame = self.containerView.bounds; } [self.userWallViewController.containerView addSubview:self.userWallViewController.activityFeedTableView]; //If the currentviewcontroller adn […]