ios开发默认字体的分享的图片多大

标签:至少1个,最多5个
图片点击放大,再次点击返回原视图.完美封装,一个类一句代码即可调用.IOS完美实现
创建了一个专门用于放大图片的类,以下为.h文件
&foundation foundation.h=""&
@interface
SJAvatarBrowser : NSObject
oldImageView
头像所在的imageView
+(void)showImage:(UIImageView*)avatarImageV
@end&/foundation&
以下为.m文件
"SJAvatarBrowser.h"
@implementation
SJAvatarBrowser
+(void)showImage:(UIImageView *)avatarImageView{
UIImage *image=avatarImageView.
UIWindow *window=[UIApplication sharedApplication].keyW
UIView *backgroundView=[[UIView alloc]initWithFrame:CGRectMake(0,
[UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
oldframe=[avatarImageView convertRect:avatarImageView.bounds toView:window];
backgroundView.backgroundColor=[UIColor blackColor];
backgroundView.alpha=0;
UIImageView *imageView=[[UIImageView alloc]initWithFrame:oldframe];
imageView.image=
imageView.tag=1;
[backgroundView addSubview:imageView];
[window addSubview:backgroundView];
UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideImage:)];
[backgroundView addGestureRecognizer: tap];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame=CGRectMake(0,([UIScreen
mainScreen].bounds.size.height-image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width)/2,
[UIScreen mainScreen].bounds.size.width, image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width);
backgroundView.alpha=1;
} completion:^(BOOL finished) {
+(void)hideImage:(UITapGestureRecognizer*)tap{
UIView *backgroundView=tap.
UIImageView *imageView=(UIImageView*)[tap.view viewWithTag:1];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame=
backgroundView.alpha=0;
} completion:^(BOOL finished) {
[backgroundView removeFromSuperview];
引入此类之后,为自己需要放大的imageView添加tap手势
UITapGestureRecognizer
= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(magnifyImage)];
[self.imageView addGestureRecognizer:tap];
-(void)magnifyImage
NSLog(@"局部放大");
[SJAvatarBrowser
showImage:self.imageView];//调用方法
分享来源:
0 收藏&&|&&3
你可能感兴趣的文章
2 收藏,1.4k
14 收藏,3k
43 收藏,5.5k
分享到微博?
你好!看起来你挺喜欢这个内容,但是你还没有注册帐号。 当你创建了帐号,我们能准确地追踪你关注的问题,在有新答案或内容的时候收到网页和邮件通知。还能直接向作者咨询更多细节。如果上面的内容有帮助,记得点赞 (????)? 表示感谢。
明天提醒我
我要该,理由是:
扫扫下载 AppIOS开发----&IOS7官方推荐图标和图像尺寸
图标和图像大小
每一个应用程序需要一个应用程序图标和启动图像。此外,一些应用程序需要自定义的图标来表示特定于应用程序的内容,功能,或在导航栏,工具栏和标签栏模式。
不像其他的定制艺术品在您的应用程序的图标和图像,表38-1列出必须满足特定的标准,因此,IOS可以正确显示。此外,一些图标和图像文件的命名要求。(如果你需要支持标准分辨率的iPhone或iPod
touch设备,除以2下面列出高分辨率的大小。)
表38-1自定义图标和图像尺寸(像素)
iPhone 5和iPod touch的尺寸(高清晰度)
大小为iPhone和iPod touch(高分辨率)
iPad的尺寸为(高清晰度)
大小为iPad 2和iPad迷你(标准分辨率)
应用程序图标(应用程序所需的所有)
为App Store(应用程序所需的所有应用程序图标)
启动影像(所有的应用程序所需的)
768&1024(纵向)
Spotlight搜索结果图标(推荐)
设置图标(推荐)
工具栏和导航栏图标(可选)
标签栏图标(可选)
约60&60(最大:96&64)
约60&60(最大:96&64)
约60&60(最大:96&64)
约30&30(最大:48&32)
默认报刊亭盖为App Store图标(书报亭应用程序所需)
至少为1024像素的最长边
至少为1024像素的最长边
至少为1024像素的最长边
至少为1024像素的最长边
网页剪辑图标(推荐的Web应用程序和网站)
所有图像和图标,PNG格式的建议。你应该避免使用隔行扫描的PNG图像。
图标和图像的标准位深度为24位,8位分别为红,绿,蓝加一个8位的alpha通道。
你并不需要限制你的网页安全色调色板。
/applenews/devnews/29.html
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。主题 : ios 让图片适应imageview的大小
级别: 新手上路
UID: 156632
可可豆: 114 CB
威望: 112 点
在线时间: 106(时)
发自: Web Page
ios 让图片适应imageview的大小&&&
从网络加载图片放在UITableViewCell中,然后让cell在tabbleView中显示,但是图片却大小不一,显示时,每行的图片不能对弃,很难看。不知怎么让下载的图片自动适应设定好的imageview的大小
级别: 侠客
可可豆: 673 CB
威望: 681 点
在线时间: 276(时)
发自: Web Page
把UIImageView的contentMode收属性设置为:UIViewContentModeScaleToFill试试。
不过即使显示的一样大了,也会出现非等比例拉伸和压缩的效果,看着可能也有些别扭。
级别: 新手上路
UID: 156632
可可豆: 114 CB
威望: 112 点
在线时间: 106(时)
发自: Web Page
不管用,我试过了
级别: 新手上路
UID: 217915
可可豆: 166 CB
威望: 172 点
在线时间: 297(时)
发自: Web Page
UIImageView &每张图片加载时先设置UIImageView&对象的 frame ...&
级别: 侠客
可可豆: 673 CB
威望: 681 点
在线时间: 276(时)
发自: Web Page
理论上这样设置应该可以了。还不行的话,想想其它方面的原因,比如刷新时机等等
级别: 新手上路
可可豆: 50 CB
威望: 30 点
在线时间: 237(时)
发自: Web Page
楼主 您这个问题后来怎么解决的呢?沃野遇到相同的问题了
级别: 新手上路
可可豆: 9 CB
威望: 9 点
在线时间: 50(时)
发自: Web Page
爬的一篇文章,应该能帮到你 :【不知合适不合适,这样直接链接】
级别: 新手上路
UID: 486409
可可豆: 38 CB
威望: 24 点
在线时间: 300(时)
发自: Web Page
回 6楼(law) 的帖子
这个分享棒棒的 哈哈
级别: 侠客
UID: 513808
可可豆: 437 CB
威望: 435 点
在线时间: 212(时)
发自: Web Page
在imgView加载图片前规定死imgView得Frame.不过这样做,图片可能不是等比例缩放.看着所很别扭.
级别: 新手上路
UID: 148664
可可豆: 52 CB
威望: 49 点
在线时间: 24(时)
发自: Web Page
你参考一下这个方法处理一下图片看看可以不
关注本帖(如果有新回复会站内信通知您)
苹果公司现任CEO是谁?2字 正确答案:库克
发帖、回帖都会得到可观的积分奖励。
按"Ctrl+Enter"直接提交
关注CocoaChina
关注微信 每日推荐
扫一扫 浏览移动版最近在做一个关于跑步的软件,集成了ShareSDK分享的平台,下面直接上代码(写的不好的地方,希望各位指出,谢谢):-(void)btnShare{& & // download URL& & NSString *strURL = [NSString stringWithFormat:@&/healthrun&];& &&& & DatabaseManager *dm = [[DatabaseManager alloc] init];& & VHSActionData *actionlData = [dm selectOneFromActionLst:_actionId];& &&& & // 微博文字内容140字& & NSString *strWeibo = [NSString stringWithFormat:@&我在%@,使用“Runner”运动了%0.2f公里,用时%@。\n\n/healthrun\n&,actionlData.startTime,actionlData.distance,[VHSCommon getHmsFromSecond:actionlData.seconds]];& &&& & UIImage *shareimage = &[self imageFromView:self.view];& &&& & // 分享内容协议& & id&ISSContent& publishContent = [ShareSDK content:strWeibo& & & & & & & & & & & & & & & & & & & &defaultContent:strWeibo& & & & & & & & & & & & & & & & & & & & & & & & image:[ShareSDK pngImageWithImage:shareimage]& & & & & & & & & & & & & & & & & & & & & & & & title:@&Runner&& & & & & & & & & & & & & & & & & & & & & & & & & url:strURL& & & & & & & & & & & & & & & & & & & & & description:nil& & & & & & & & & & & & & & & & & & & & & & mediaType:SSPublishContentMediaTypeImage];& &&& & // 定制邮件& & [publishContent addMailUnitWithSubject:@&Runner&& & & & & & & & & & & & & & & & & &content:strWeibo& & & & & & & & & & & & & & & & & & isHTML:[NSNumber numberWithBool:NO]& & & & & & & & & & & & & & & &attachments:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & to:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & cc:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & &bcc:INHERIT_VALUE];& &&& & //定制新浪微博& & [publishContent addSinaWeiboUnitWithContent:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & & image:INHERIT_VALUE];& &&& & //定制微信好友信息& & [publishContent addWeixinSessionUnitWithType:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & &content:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & & &title:@&Runner&& & & & & & & & & & & & & & & & & & & & & & &url:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & thumbImage:INHERIT_VALUE& & & & & & & & & & & & & & & & & & & & & &image:INHERIT_VALUE& & & & & & & & & & & & & & & & & & musicFileUrl:nil& & & & & & & & & & & & & & & & & & & & &extInfo:nil& & & & & & & & & & & & & & & & & & & & fileData:nil& & & & & & & & & & & & & & & & & & emoticonData:nil];& &&& & // 定制QQ& & [publishContent addQQUnitWithType:[NSNumber numberWithInt:SSPublishContentMediaTypeImage]& & & & & & & & & & & & & & & content:INHERIT_VALUE& & & & & & & & & & & & & & & & title:INHERIT_VALUE& & & & & & & & & & & & & & & & & url:strURL& & & & & & & & & & & & & & & & image:INHERIT_VALUE];& &&& & //定制人人网信息& & [publishContent addRenRenUnitWithName:@&Runner&& & & & & & & & & & & & & & & description:strWeibo& & & & & & & & & & & & & & & & & & & url:INHERIT_VALUE& & & & & & & & & & & & & & & & & message:strWeibo& & & & & & & & & & & & & & & & & & image:[ShareSDK pngImageWithImage:shareimage]& & & & & & & & & & & & & & & & & caption:INHERIT_VALUE];& &&& & //创建弹出菜单容器& & id&ISSContainer& container = [ShareSDK container];& & [container setIPadContainerWithView:self.view arrowDirect:UIPopoverArrowDirectionAny];& &&& & //设置导航栏的view delegate& & viewDelegate = [[AGViewDelegate alloc] init];& &&& & id&ISSAuthOptions& authOptions = [ShareSDK authOptionsWithAutoAuth:YES& & & & & & & & & & & & & & & & & & & & & & & & & & & & &allowCallback:YES& & & & & & & & & & & & & & & & & & & & & & & & & & & & &authViewStyle:SSAuthViewStyleFullScreenPopup& & & & & & & & & & & & & & & & & & & & & & & & & & & & & viewDelegate:viewDelegate& & & & & & & & & & & & & & & & & & & & & & & &authManagerViewDelegate:viewDelegate];& & //在授权页面中添加关注官方微博& & [authOptions setFollowAccounts:[NSDictionary dictionaryWithObjectsAndKeys:& & & & & & & & & & & & & & & & & & [ShareSDK userFieldWithType:SSUserFieldTypeName value:@&ShareSDK&],& & & & & & & & & & & & & & & & & & SHARE_TYPE_NUMBER(ShareTypeSinaWeibo),& & & & & & & & & & & & & & & & & & [ShareSDK userFieldWithType:SSUserFieldTypeName value:@&ShareSDK&],& & & & & & & & & & & & & & & & & & SHARE_TYPE_NUMBER(ShareTypeTencentWeibo),& & & & & & & & & & & & & & & & & & nil]];& &&& & id&ISSShareOptions& shareOptions = [ShareSDK defaultShareOptionsWithTitle:@&Runner&& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & oneKeyShareList:[NSArray defaultOneKeyShareList]& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &qqButtonHidden:YES& & & & & & & & & & & & & & & & & & & & & & & & & & & & wxSessionButtonHidden:YES& & & & & & & & & & & & & & & & & & & & & & & & & & & &wxTimelineButtonHidden:YES& & & & & & & & & & & & & & & & & & & & & & & & & & & & &showKeyboardOnAppear:NO& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & shareViewDelegate:viewDelegate& & & & & & & & & & & & & & & & & & & & & & & & & & & & & friendsViewDelegate:viewDelegate& & & & & & & & & & & & & & & & & & & & & & & & & & & & picViewerViewDelegate:nil];& &&& & // 定制分享列表& & NSArray *shareList = [ShareSDK getShareListWithType:& & & & & & & & & & & & & ShareTypeWeixiSession,& & & & & & & & & & & & & ShareTypeWeixiTimeline,& & & & & & & & & & & & & ShareTypeQQ,& & & & & & & & & & & & & ShareTypeSinaWeibo,& & & & & & & & & & & & & ShareTypeRenren,& & & & & & & & & & & & & ShareTypeDouBan,& & & & & & & & & & & & & nil];& &&& & //弹出分享菜单& & [ShareSDK showShareActionSheet:container& & & & & & & & & & & & &shareList:shareList& & & & & & & & & & & & & &content:publishContent& & & & & & & & & & &statusBarTips:YES& & & & & & & & & & & &authOptions:authOptions& & & & & & & & & & & shareOptions:shareOptions& & & & & & & & & & & & & & result:^(ShareType type, SSResponseState state, id&ISSPlatformShareInfo& statusInfo, id&ICMErrorInfo& error, BOOL end) {& & & & & & & & & & & & & & & &&& & & & & & & & & & & & & & & & bgView.hidden = YES;& & & & & & & & & & & & & & & &&& & & & & & & & & & & & & & & & if (state == SSResponseStateSuccess)& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & [PXAlertView showAlertWithTitle:@&提示& message:@&分享成功& cancelTitle:LABEL_BUTTON_CONFIRM completion:^(BOOL cancelled) {& & & & & & & & & & & & & & & & & & }];& & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & & & else if (state == SSResponseStateFail)& & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & [PXAlertView showAlertWithTitle:@&提示& message:@&分享失败& cancelTitle:LABEL_BUTTON_CONFIRM completion:^(BOOL cancelled) {& & & & & & & & & & & & & & & & & & }];& & & & & & & & & & & & & & & & }& & & & & & & & & & & & & & }];}// iphone 截屏方法- (UIImage *)imageFromView:(UIView *)theView{& & UIGraphicsBeginImageContext(theView.frame.size);& & CGContextRef context = UIGraphicsGetCurrentContext();& & [theView.layer renderInContext: context];& & UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();& & UIGraphicsEndImageContext();& & return theI}
以上就介绍了集成ShareSDK分享当前屏幕图片的方法,包括了方面的内容,希望对IOS开发有兴趣的朋友有所帮助。
本文网址链接:/article/detail_169532.html
上一篇: 下一篇:微信公众平台
本站所有资源单价10元一个,100元包年,免费下载。
IOS中修改图片的大小:修改分辨率和裁剪
在IOS开发中,经常有限制图片文件大小的,有的用户图片很大,导致上传时间慢,造成问题。
如:微信分享中,如果图片的大小好像大于50kbytes,就分享失败,而且没有任何提示。
所以,我添加了两个函数:
一、修改当前图片的大小,newSize是新的size尺寸,这个方法帮助用户获取到更小的图片。
但是这个newSize的尺寸建议跟原图一样,不然图片就变形了。
- (UIImage*)imageWithImageSimple:(UIImage*)image
scaledToSize:(CGSize)newSize
& &&// Create a graphics image context
& &&UIGraphicsBeginImageContext(newSize);
& &&// Tell the old image to draw in this new context, with the desired
& &&// new size
& & [image&drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
& &&// Get the new image from the context
& &&UIImage* newImage
=&UIGraphicsGetImageFromCurrentImageContext();
& &&// End the context
& &&UIGraphicsEndImageContext();
& &&// Return the new image.
& &&return&newI
二、截图功能,实现用户想要截取图的RECT
- (UIImage&*)getImageByCuttingImage:(UIImage&*)image
Rect:(CGRect)rect{
& &&//大图bigImage
& &&//定义myImageRect,截图的区域
& &&CGRect&myImageRect
& &&UIImage* bigImage=
& &&CGImageRef&imageRef
= bigImage.CGImage;
& &&CGImageRef&subImageRef
=&CGImageCreateWithImageInRect(imageRef, myImageRect);
& &&CGSize&
& & size.width&=
rect.size.width;
& & size.height&=
rect.size.height;
& &&UIGraphicsBeginImageContext(size);
& &&CGContextRef&context
=&UIGraphicsGetCurrentContext();
& &&CGContextDrawImage(context,
myImageRect, subImageRef);
& &&UIImage* smallImage
= [UIImage&imageWithCGImage:subImageRef];
& &&UIGraphicsEndImageContext();
& &&return&smallI
版权声明:本文为博主原创文章,未经博主允许不得转载。
( 9:38:25)
( 9:38:25)
( 9:38:24)
( 9:38:23)
( 9:38:23)
( 9:38:23)
( 9:38:22)
( 8:58:08)
你这个评论的模块是怎么实现的,能不能写一下哇,觉得很好看
管理员回复:
我晕,我什么时候购买博主的模板了??首先声明的是 我的微之恋是用大前端的html页面,HTML页面我也是Ctrl+s进行另存为下来的,然后我用wordpress的程序改了改就发布了,很多bug我也懒得改,功能也没有大前段的主题功能强大,也就可以认为一个演示版吧,首先说的是本人木有购买,再者更没有购买后无耻进行发布,我只是靠的自己的双手收获我想要的成功,我想这就是开源精神吧?我把自己写的代码进行开源有何不可?况且我只是另存为了3个页面其他的PHP程序还不是都是我写的,大家爱用就用,不爱用也不要冷嘲热讽好不好?拿着我的免费主题说我的坏话,我真的很无语!

我要回帖

更多关于 ios微信分享开发平台 的文章

 

随机推荐