UIActionSheet 弹出时箭头
来源:互联网 发布:android源码 小米商城 编辑:程序博客网 时间:2024/04/30 12:05
1.调整ipad上UIActionSheet的arrow方向
ipad上面UIActionSheet可以有箭头,但其方向不能像popover那样调整,上面查资料有如下解决方法:
参考:http://stackoverflow.com/questions/3763324/uiactionsheet-change-arrow-position
重要的就是这两句:
Apple doesn't provide any access to internal structure for UIActionSheet's internal implementation of showFromRect, but as for arrow direction, there is actually a very hack-y way to work around this and sort of being able to change arrow direction to a desired direction.
Trick is to mess around the rect parameter in - (void)showFromRect:(CGRect)rect inView (UIView *)view animated:(BOOL)animated. Apple doesn't document this rect parameter very well, butif your original rect will give you a down arrow direction, feed in a rect with a large height and negative number origin.y will kind of push the action sheet popover all the way up thus showing a upward arrow direction. This is a extreme hack but it works consistently across firmware.
2.应用
工作中遇到编辑头像,图片来源:camera,album两种,在Iphone上面没有问题,但在Ipad上由于上面区别就有问题了
先弹UIActionSheet,但弹出来的总是箭头向下的,我想弹个箭头向上,以便切换成Popover时在同一位置
ipad上面UIActionSheet可以有箭头,但其方向不能像popover那样调整,上面查资料有如下解决方法:
参考:http://stackoverflow.com/questions/3763324/uiactionsheet-change-arrow-position
重要的就是这两句:
Apple doesn't provide any access to internal structure for UIActionSheet's internal implementation of showFromRect, but as for arrow direction, there is actually a very hack-y way to work around this and sort of being able to change arrow direction to a desired direction.
Trick is to mess around the rect parameter in - (void)showFromRect:(CGRect)rect inView (UIView *)view animated:(BOOL)animated. Apple doesn't document this rect parameter very well, butif your original rect will give you a down arrow direction, feed in a rect with a large height and negative number origin.y will kind of push the action sheet popover all the way up thus showing a upward arrow direction. This is a extreme hack but it works consistently across firmware.
2.应用
工作中遇到编辑头像,图片来源:camera,album两种,在Iphone上面没有问题,但在Ipad上由于上面区别就有问题了
先弹UIActionSheet,但弹出来的总是箭头向下的,我想弹个箭头向上,以便切换成Popover时在同一位置
初始代码:
- UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"camera" otherButtonTitles:nil];
- [sheet addButtonWithTitle:@"album"];
- // avaterBtn bounds:(0,0,80,80)
- [sheet showFromRect:CGRectMake(0, 0, 80, 80) inView:avaterBtn animated:YES];
- [sheet release];
改为:
- UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"camera" otherButtonTitles:nil];
- [sheet addButtonWithTitle:@"album"];
- [sheet showFromRect:CGRectMake(0, -200, 80, 280) inView:avaterBtn animated:YES];
- [sheet release];
从事Ios开发快一年了,以后遇到问题时不能网上搜搜解决就行,一定要深入了解其原理
- UIActionSheet 弹出时箭头
- 使用UIActionSheet 弹出UIDatePicker
- UIActionSheet 弹出UIDatePicker
- iphone 弹出表单UIActionSheet的应用。
- UIWebView 禁止检测链接弹出UIActionSheet
- iOS8中UIActionSheet弹出UIImagePickerController异常处理
- iPad中UIActionSheet弹出UIImagePickerController异常处理
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- My Oracle Support: Year of Innovation(2012)
- WPF 数据绑定
- coredata 最简单例子
- Windows下usb接口驱动技术(一)
- STL iterator的自己实现
- UIActionSheet 弹出时箭头
- 父游标与子游标
- iPhone开发关于UDID和UUID的一些理解
- Windows下usb接口驱动技术(二)
- An introduction to C++ Traits
- IOS 自定义导航栏背景
- FastReport.Net教程大全
- IOS 单例
- 黑马程序员 JAVA__高新技术--泛型总结