移动带边界的视图到任意位置
来源:互联网 发布:台湾网络节点是什么 编辑:程序博客网 时间:2024/05/16 18:19
将视图移动到某一个随机位置时,必须考虑这么几个问题:
#import
@interface
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView withInsets: (UIEdgeInsets) insets;
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView withInset: (float) inset;
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView;
- (CGPoint) centerInView: (UIView *) aView withHorizontalPercent: (float) h withVerticalPercent: (float) v;
- (CGPoint) centerInSuperviewWithHor
- (CGPoint) randomCenterInView: (UIView *) aView withInsets: (UIEdgeInsets) insets;
- (CGPoint) randomCenterInView: (UIView *) aView withInset: (float) inset;
- (void) moveToRandomLocationInVi
- (void) moveToRandomLocationInSu
@end
#import
// This is a private version of the function that appears in my UIView Frame category
// It's included here as a private function to avoid requiring the other file
CGRect rectWithCenter(CGRect rect, CGPoint center)
{
CGRect newrect = CGRectZero;
newrect.origin.x = center.x-CGRectGetMidX(rect);
newrect.origin.y = center.y-CGRectGetMidY(rect);
newrect.size = rect.size;
return
}
@implementation
#pragma mark Bounded Placement
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView withInsets: (UIEdgeInsets) insets
{
CGRect container = UIEdgeInsetsInsetRect(aView.bounds, insets);
return
}
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView withInset: (float) inset
{
UIEdgeInsets insets = UIEdgeInsetsMake(inset, inset, inset, inset);
return
}
- (BOOL) canMoveToCenter: (CGPoint) aCenter inView: (UIView *) aView
{
return
}
#pragma mark Percent Displacement
// Move view into place as a percentage-based displacement
- (CGPoint) centerInView: (UIView *) aView withHorizontalPercent: (float) h withVerticalPercent: (float) v
{
// Move in by the inset amount and then by size of the subview
CGRect baseRect = aView.bounds;
CGRect subRect = CGRectInset(baseRect,
// Return a point that is h% horizontal and v% vertical
float
float
return
}
- (CGPoint) centerInSuperviewWithHor
{
return
}
#pragma mark Random
// Make sure you've run srandom() elsewhere in the program
// Thanks to August Joki and manitoba98
- (CGPoint) randomCenterInView: (UIView *) aView withInsets: (UIEdgeInsets) insets
{
// Move in by the inset amount and then by size of the subview
CGRect innerRect = UIEdgeInsetsInsetRect([aView bounds], insets);
CGRect subRect = CGRectInset(innerRect,
// Return a random point
float
float
return
}
- (CGPoint) randomCenterInView: (UIView *) aView withInset: (float) inset
{
UIEdgeInsets insets = UIEdgeInsetsMake(inset, inset, inset, inset);
return
}
- (void) moveToRandomLocationInVi
{
if
{
self.center = [self
return;
}
// Why 0.3f seconds? Because that is the time used to display a keyboard
CGContextRef context = UIGraphicsGetCurrentCont
[UIView beginAnimations:nil
[UIView setAnimationCurve:UIViewAnimationCurveEase
[UIView setAnimationDuration:0.3f];
self.center = [self
[UIView commitAnimations];
}
- (void) moveToRandomLocationInSu
{
[self
}
@end
- 移动带边界的视图到任意位置
- 我的Unity(1)一点一滴 鼠标点击任意位置,物体移动到该位置。
- scrollview显示到任意位置的定位
- 从一个页面跳转到另一个页面的指定位置(带平滑移动的效果)
- 从一个页面跳转到另一个页面的指定位置(带平滑移动的效果)
- cocos2dx scrollview将选中项移动到视图中间位置
- 用SQLServer实现数据表中,将任意一条记录信息移动到该表中的任意位置
- 用SQLServer实现数据表中,将任意一条记录信息移动到该表中的任意位置
- 如何将ffmpeg的dll放置到任意位置?
- viso2003下动态连接线的自带文本框位置移动
- vc 点窗体任意位置进行移动
- 点击视图上任意位置回收键盘的方法(添加手势)
- UICollectionView 视图滚动到指定位置的方法
- C#控制定位Word光标移动到任意行或者最后一行,取得光标位置等操作
- C#控制定位Word光标移动到任意行或者最后一行,取得光标位置等操作
- C#控制定位Word光标移动到任意行或者最后一行,取得光标位置等操作
- 拖动窗口任意位置移动窗口(网上找的没有整理)
- easyUI datagird实现对行的任意拖拽移动位置
- ActivityGroup对子Activity的管理
- 新手入门之——Linux学习基础
- Python搭配MongoDB使用方法
- 雷锋网专访薄荷团队:贴近用户才能走得更远
- 另人抓狂的错误:java.lang.IllegalArgumentException: No property find found for type class
- 移动带边界的视图到任意位置
- 终止线程的运行
- Windows OOP与Cocoa MVC对比
- JS选择文件夹对话框(实现文件夹上传) .
- Rest in sping 3.x and servlet
- iOS线程开发之--BLOCK & GCD(Grand Central Dispatch)
- WCF简单教程(1) 入门
- HibernateTemplate源码
- orade中插入大数据类型BLob