cell

What is NSLayoutConstraint “UIView-Encapsulated-Layout-Height” and how should I go about forcing it to recalculate cleanly?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a UITableView running under iOS 8 and I'm using automatic cell heights from constraints in a storyboard. One of my cells contains a single UITextView and I need it to contract and expand based on user input - tap to shrink/expand the text. I'm doing this by adding a runtime constraint to the text view and changing the constant on the constraint in response to user events: -( void ) collapse :( BOOL ) collapse ; { _collapsed = collapse ; if ( collapse ) [ _collapsedtextHeightConstraint setConstant : kCollapsedHeight ]; // 70

When to use dequeueReusableCellWithIdentifier vs dequeueReusableCellWithIdentifier : forIndexPath

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There are two overloads for dequeueReusableCellWithIdentifier and I'm trying to determine when should I use one vs the other? The apple docs regarding the forIndexPath function states, "This method uses the index path to perform additional configuration based on the cell’s position in the table view." I'm not sure how to interpret that though? 回答1: The most important difference is that the forIndexPath: version asserts (crashes) if you didn't register a class or nib for the identifier. The older (non- forIndexPath: ) version returns nil in

UICollectionView Self Sizing Cells with Auto Layout

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get self sizing UICollectionViewCells working with Auto Layout, but I can't seem to get the cells to size themselves to the content. I'm having trouble understanding how the cell's size is updated from the contents of what's inside the cell's contentView. Here's the setup I've tried: Custom UICollectionViewCell with a UITextView in its contentView. Scrolling for the UITextView is disabled. The contentView's horizontal constraint is: "H:|[_textView(320)]", i.e. the UITextView is pinned to the left of the cell with an explicit

VBA code doesn't run when cell is changed by a formula

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Worksheet A has ranges of data that are collected from Worksheet B . Worksheet A has a macro that calculates if the data is above a value then calls an email module to email selected users. When the data is manually input on Worksheet A the Macro works, however when data is pulled from Worksheet B it doesn't fire. I'm not sure what I need to change in my VBA code. Private Sub Worksheet_Change(ByVal Target As Range) Call MailAlert(Target, "B5:M5", 4) Call MailAlert(Target, "B8:M8", 7) Call MailAlert(Target, "B11:M11", 6) Call MailAlert(Target

jqgrid: How to set cell specific css class at generation time

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am building a jqgrid that needs different background (or in general, a different css class) value for specific cells. I know which cells need the class applied at generation time of the data being sent down to jqgrid. What I would like is to be able to indicate a class within the jqgrid rows structure for each specific cell: 1.00 15.00 9.00 … 1.00 2.00 1.15 … … I know I can do this formatting after the data is sent down, but I would like to see the grid drawn with the formatting in place rather than after the fact. I've achieved something

indexPathForCell returns nil since ios7

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: my app was running fine under ios6.1. tried the ios7 simulator and the following part does not work: EditingCell *cell = (EditingCell*) [[textField superview] superview]; NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; NSLog(@"the section is %d and row is %d", indexPath.section, indexPath.row); NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; NSString *rowKey = [[keysForRows objectAtIndex: section] objectAtIndex: row]; It always comes: the section is 0 and row is 0 although another section / row

Multiple UITableViews on one UIView

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to have two UITableViews on one UIView. I can make it work with one, here is the code: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [contentOne count]; // sets row count to number of items in array } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView

NSIndexPath and IndexPath in Swift 3.0

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have recently converted my code to Swift 3.0. My collection view and table view data source methods now contain IndexPath instead of NSIndexPath in their method signature. But still inside the method definition it is type casting IndexPath to NSIndexPath. i.e. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell : NNAmenitiesOrFurnishingCollectionViewCell = self.amenitiesOrFurnishingCollectionView.dequeueReusableCell(withReuseIdentifier:

How to observe individual array element changes (update) with Swift and KVO?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Do I need to subscribe/unsubscribe to individual elements of an array? I want to update each table view cell individually to reflect changes in the backing array. By changes I mean not append/remove operations but update of the properties of the objects of the array. I hope I was able to explain what I want to achieve. Thanks 回答1: To use KVO, declare the model object with dynamic properties: class Foo: NSObject { @objc dynamic var bar: String // in Swift 3, `@objc` is not necessary; in Swift 4 we must make this explicit init(bar: String) {

Bypass read only cells in DataGridView when pressing TAB key

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can anyone show me some code of how I could bypass read only cells in DatagridView when pressing TAB key? 回答1: Overriding the SelectionChanged event is the right approach. The property CurrentCell can be used to set the current cell. You want something like this: private void dataGridView_SelectionChanged(object sender, EventArgs e) { DataGridViewCell currentCell = dataGridView.CurrentCell; if (currentCell != null) { int nextRow = currentCell.RowIndex; int nextCol = currentCell.ColumnIndex + 1; if (nextCol == dataGridView.ColumnCount) {