Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)updateTableContentInset {
- NSInteger numRows = [self tableView:self.tableView numberOfRowsInSection:0];
- CGFloat contentInsetTop = self.tableView.bounds.size.height;
- for (NSInteger i = 0; i < numRows; i++) {
- contentInsetTop -= [self tableView:self.tableView heightForRowAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]];
- if (contentInsetTop <= 0) {
- contentInsetTop = 0;
- break;
- }
- }
- self.tableView.contentInset = UIEdgeInsetsMake(contentInsetTop, 0, 0, 0);
- }
- dataSourceArray = dataSourceArray.reverseObjectEnumerator.allObjects;
- func updateTableContentInset() {
- let numRows = tableView(tableView, numberOfRowsInSection: 0)
- var contentInsetTop = tableView.bounds.size.height
- for i in 0..<numRows {
- contentInsetTop -= tableView(tableView, heightForRowAtIndexPath: NSIndexPath(forItem: i, inSection: 0))
- if contentInsetTop <= 0 {
- contentInsetTop = 0
- }
- }
- tableView.contentInset = UIEdgeInsetsMake(contentInsetTop, 0, 0, 0)
- }
- func updateTableContentInset() {
- let numRows = tableView(tableView, numberOfRowsInSection: 0)
- var contentInsetTop = self.tableView.bounds.size.height
- for i in 0..<numRows {
- contentInsetTop -= tableView(tableView, heightForRowAt: IndexPath(item: i, section: 0))
- if contentInsetTop <= 0 {
- contentInsetTop = 0
- }
- }
- tableView.contentInset = UIEdgeInsetsMake(contentInsetTop, 0, 0, 0)
- }
- NSString *yourObject = dataArray[[dataArray count] - 1 - indexPath.row];
- cell.textLabel.text = yourObject
- -(void)startObservingContentSizeChanges
- {
- [self.tableView addObserver:self forKeyPath:kKeyPathContentSize options:0 context:nil];
- }
- -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
- {
- if([keyPath isEqualToString:kKeyPathContentSize] && object == self.tableView)
- {
- // difference between content and table heights. +1 accounts for last row separator
- CGFloat height = MAX(self.tableView.frame.size.height - self.tableView.contentSize.height, 0) + 1;
- self.tableView.contentInset = UIEdgeInsetsMake(height, 0, 0, 0);
- // "scroll" to top taking inset into account
- [self.tableView setContentOffset:CGPointMake(0, -height) animated:NO];
- }
- }
- let reverseIndex = myArray.count-indexPath.row-1
- let currCellData = myArray.object(at: reverseIndex)
- self.tableView.transform = CGAffineTransform.init(rotationAngle: (-(CGFloat)(M_PI)))
- self.tableView.transform = CGAffineTransform.init(translationX: -view.frame.width, y: view.frame.height)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement