PathCover个人主页控件使用
继续上次的项目
http://www.cnblogs.com/luoxiaoxi/p/5067689.html
1,添加PathCover库
并添加库的引用
2,屏蔽掉之前的MJRefresh的下拉刷新函数,添加一个PathCover变量
var head:XHPathCover!
3,在viewDid Load中配置head
head = XHPathCover(frame : CGRectMake(0, 0, 320, 200))
head.setBackgroundImage(UIImage(named: "BG"))
head.setAvatarImage(UIImage(named: "cute_girl.jpg"))
head.isZoomingEffect = true;
head.setInfo(NSDictionary(objectsAndKeys: "StrongX",XHUserNameKey,"iOS工程师",XHBirthdayKey) as [NSObject:AnyObject])
head.avatarButton.layer.cornerRadius = 33;
head.avatarButton.layer.masksToBounds = true
head.handleRefreshEvent = {
self.headRefresh()
}
tableView.tableHeaderView = head;
4,下拉操作需要实现scrollView
override func scrollViewDidScroll(scrollView: UIScrollView) {
head.scrollViewDidScroll(scrollView)
}
override func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
head.scrollViewDidEndDecelerating(scrollView)
}
override func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
head.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
}
override func scrollViewWillBeginDragging(scrollView: UIScrollView) {
head.scrollViewWillBeginDragging(scrollView)
}
5,添加使小球停止转动的方法