加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

NS类 - NSIndexPath

(2013-04-18 12:45:59)
标签:

nsindexpath

it

分类: Mac/IOS那些事

|--NSIndexPath实现机制

 

http://s5/mw690/79fded95gda9b527390c4&690NSIndexPath" TITLE="NS类 NSIndexPath" />


|--NSIndexPath里的方法

#import


@interface NSIndexPath : NSObject <</span>NSCopying, NSCoding> {

@private

__strong NSUInteger *_indexes;

NSUInteger _hash;

NSUInteger _length;

        void *_reserved;

}


+ (id)indexPathWithIndex:(NSUInteger)index;

+ (id)indexPathWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length;


- (id)initWithIndex:(NSUInteger)index;

- (id)initWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length;    // designated initializer


- (NSIndexPath *)indexPathByAddingIndex:(NSUInteger)index;

- (NSIndexPath *)indexPathByRemovingLastIndex;


- (NSUInteger)indexAtPosition:(NSUInteger)position;

- (NSUInteger)length;


- (void)getIndexes:(NSUInteger *)indexes;


// comparison support

- (NSComparisonResult)compare:(NSIndexPath *)otherObject; // sorting an array of indexPaths using this comparison results in an array representing nodes in depth-first traversal order


@end

 

Demo 建一个indexpath给一个Tableview

         然后当过来的index值的时候选中一个section滚动到顶部

-(void)selectTimeShowLrc:(NSUInteger)index

{

    NSIndexPath* indexPath = [NSIndexPath indexPathForRow:index inSection:0];

    [_LRCTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionTop];

}

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有