iOS仿微信图片分享界面实现代码

分享功能目前几乎已成为很多app的标配了,其中微信,微博等app的图片分享界面设计的很棒,不仅能够展示缩略图,还可以预览删除。最近我在做一款社交分享app,其中就要实现图文分享功能,于是试着自行实现仿微信分享风格的功能。

核心思想:

主要是使用UICollectionView来动态加载分享图片内容,配合预览页面,实现动态添加和预览删除图片效果。

实现效果:

核心代码如下:

分享界面:

//
//
 PostTableViewController.h
//
 NineShare
//
//
 Created by 张昌伟 on 15/1/26.
//
 Copyright (c) 2015年 9Studio. All rights reserved.
//

#import
 <UIKit/UIKit.h>
#import
 "UMSocial.h"
#import
 "YSYPreviewViewController.h"

@interface PostTableViewController
 : UITableViewController<UITextViewDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UIActionSheetDelegate,UIImagePickerControllerDelegate,UMSocialUIDelegate,UINavigationControllerDelegate>

@property (weak,
nonatomic)
IBOutlet UICollectionView
 *photosCollectionView;
@property (weak,
nonatomic)
IBOutlet UISwitch
 *WeiboSwitch;
@property (weak,
nonatomic)
IBOutlet UISwitch
 *RenrenSwitch;
-
 (IBAction)DoubanSwitched:(id)sender;
-
 (IBAction)RenrenSwitched:(id)sender;
-
 (IBAction)WeiboSwitched:(id)sender;

+(void)
 deleteSelectedImage:(NSInteger)
 index;
+(void)
 deleteSelectedImageWithImage:(UIImage*)image;
@end

实现文件

//
//
 PostTableViewController.m
//
 NineShare
//
//
 Created by 张昌伟 on 15/1/26.
//
 Copyright (c) 2015年 9Studio. All rights reserved.
//

#import
 "PostTableViewController.h"
#import
 "NineShareService.h"
static NSMutableArray *currentImages;
@interface PostTableViewController
 ()
@property (weak,
nonatomic)
IBOutlet UITextView
 *shareContent;
-
 (IBAction)postStatus:(id)sender;
-
 (IBAction)cancelPost:(id)sender;
-(void)
 loadSNSStatus;
@property (weak,
nonatomic)
IBOutlet UISwitch
 *DoubanSwitch;
@property (weak,
nonatomic)
IBOutlet UITextView
 *backgroundTextView;
@property NSMutableArray *snsArray;
//@property
 NSMutableArray *photos;
@property NineShareService
 *dataContext;
@property NSMutableDictionary *tempDict;

-(void)
 openCamera;
-(void)
 openLibary;

@end

@implementation PostTableViewController

-
 (void)viewDidLoad
 {
 [super viewDidLoad];
 if(currentImages
 ==nil)
 {
 currentImages=[[NSMutableArray alloc]
 init];
 }
 //
 Uncomment the following line to preserve selection between presentations.
 //
 self.clearsSelectionOnViewWillAppear = NO;

 //
 Uncomment the following line to display an Edit button in the navigation bar for this view controller.
 //
 self.navigationItem.rightBarButtonItem = self.editButtonItem;
 _dataContext=[NineShareService
 getInstance];
 [self loadSNSStatus];
}
-(void)viewWillAppear:(BOOL)animated{
 [_photosCollectionView
 reloadData];
}
-
 (void)didReceiveMemoryWarning
 {
 [super didReceiveMemoryWarning];
 //
 Dispose of any resources that can be recreated.
}

-(void)
 loadSNSStatus{
 _snsArray=[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle]
 pathForResource:@"sns" ofType:@"plist"]];
 if(_snsArray.count>0)
 {
 [_WeiboSwitch
 setOn:[_snsArray[0] boolValue] animated:YES];
 [_RenrenSwitch
 setOn:[_snsArray[1] boolValue] animated:YES];
 [_DoubanSwitch
 setOn:[_snsArray[2] boolValue] animated:YES];
 }
}
-(BOOL)textView:(UITextView
 *)textView shouldChangeTextInRange:(NSRange)range
 replacementText:(NSString *)text{
 if(![text
 isEqualToString:@""])
 {
 [_backgroundTextView
 setHidden:YES];
 }
 if([text
 isEqualToString:@""]&&range.length==1&&range.location==0){
 [_backgroundTextView
 setHidden:NO];
 }
 if ([text
 isEqualToString:@"\n"])
 {
 [textView
 resignFirstResponder];
 return NO;
 }
 return YES;
}
-(void)textViewDidBeginEditing:(UITextView
 *)textView
{
 CGRect
 frame = textView.frame;
 int offset
 = frame.origin.y + 32 - (self.view.frame.size.height
 - 216.0);//键盘高度216

 NSTimeInterval animationDuration
 = 0.30f;
 [UIView
 beginAnimations:@"ResizeForKeyboard" context:nil];
 [UIView
 setAnimationDuration:animationDuration];

 //将视图的Y坐标向上移动offset个单位,以使下面腾出地方用于软键盘的显示
 if(offset
 > 0)
 self.view.frame
 = CGRectMake(0.0f, -offset, self.view.frame.size.width,
self.view.frame.size.height);

 [UIView
 commitAnimations];
}

-(void)textViewDidEndEditing:(UITextView
 *)textView{
 self.view.frame
 =CGRectMake(0, 0, self.view.frame.size.width,
self.view.frame.size.height);
}
-(void)collectionView:(UICollectionView
 *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
 if(indexPath.row==currentImages.count)
 {
 UIActionSheet
 *action=[[UIActionSheet alloc] initWithTitle:@"选取照片" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"从摄像头选取",
 @"从图片库选择",nil];
 [action
 showInView:self.view];
 }
 else
 {
 [YSYPreviewViewController
 setPreviewImage:currentImages[indexPath.row]];
 [self.navigationController
 pushViewController:[[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]
 instantiateViewControllerWithIdentifier:@"PreviewVC"]
 animated:YES];
 }
}

-(NSInteger)collectionView:(UICollectionView
 *)collectionView numberOfItemsInSection:(NSInteger)section{
 return currentImages.count==0?1:currentImages.count+1;
}
-(UICollectionViewCell
 *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
 UICollectionViewCell
 *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"collectionCell" forIndexPath:indexPath];
 UIImageView
 *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
 if(currentImages.count==0||indexPath.row==currentImages.count)
 {
 imageView.image=[UIImage
 imageNamed:@"Add"];
 }
 else{

 while ([cell.contentView.subviews
 lastObject] != nil)
 {
  [(UIView*)[cell.contentView.subviews
 lastObject] removeFromSuperview];
 }
 imageView.image=currentImages[indexPath.row];
 }

 imageView.contentMode=UIViewContentModeScaleAspectFill;
 [cell.contentView
 addSubview:imageView];
 return cell;
}

-(void)saveSNSToFile{
 NSString *destPath=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES)
 lastObject];
 if (![[NSFileManager defaultManager]
 fileExistsAtPath:destPath]) {
  NSString *path=[[NSBundle mainBundle]
 pathForResource:@"sns" ofType:@"plist"];
 [[NSFileManager defaultManager]
 copyItemAtPath:path toPath:destPath error:nil];
 }

 if(_snsArray==nil)
 _snsArray=[[NSMutableArray alloc]
 init];
 [_snsArray
 removeAllObjects];
 [_snsArray
 addObject:_WeiboSwitch.isOn?@"YES":@"NO"];
 [_snsArray
 addObject:_RenrenSwitch.isOn?@"YES":@"NO"];
 [_snsArray
 addObject:_DoubanSwitch.isOn?@"YES":@"NO"];
 if(_snsArray.count>0)
 {
 [_snsArray
 writeToFile:destPath atomically:YES];
 }
}

-
 (IBAction)postStatus:(id)sender
 {
 if(_WeiboSwitch.isOn)
 [[UMSocialDataService
 defaultDataService] postSNSWithTypes:@[UMShareToSina] content:_shareContent.text.length>0?_shareContent.text: @"9Share
 for ios test message" image:currentImages.count==0?nil:currentImages[0]
 location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity
 *response){
  if (response.responseCode
 == UMSResponseCodeSuccess) {
  NSLog(@"分享成功!");
  if(!(_RenrenSwitch.isOn||_DoubanSwitch.isOn))
  {
   [self saveSNSToFile];
   [self dismissViewControllerAnimated:YES completion:nil];
  }
  }
 }];
 if(_RenrenSwitch.isOn)
 [[UMSocialDataService
 defaultDataService] postSNSWithTypes:@[UMShareToRenren] content:_shareContent.text.length>0?_shareContent.text: @"9Share
 for ios test message" image:currentImages.count==0?nil:currentImages[0]
 location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity
 *response){
  if (response.responseCode
 == UMSResponseCodeSuccess) {
  NSLog(@"分享成功!");
  if(!_DoubanSwitch.isOn)
  {
   [self saveSNSToFile];
   [self dismissViewControllerAnimated:YES completion:nil];
  }
  }
 }];
 if(_DoubanSwitch.isOn)
 [[UMSocialDataService
 defaultDataService] postSNSWithTypes:@[UMShareToDouban] content:_shareContent.text.length>0?_shareContent.text: @"9Share
 for ios test message" image:currentImages.count==0?nil:currentImages[0]
 location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity
 *response){
  if (response.responseCode
 == UMSResponseCodeSuccess) {
  NSLog(@"分享成功!");
  [self saveSNSToFile];
  [self dismissViewControllerAnimated:YES completion:nil];
  }
 }];

}

-(void)imagePickerController:(UIImagePickerController
 *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
 [picker
 dismissViewControllerAnimated:YES completion:nil];
 UIImage
 *image=[info objectForKey:UIImagePickerControllerOriginalImage];
 NSData *tempData=UIImageJPEGRepresentation(image,
 0.5f);
 image=[UIImage
 imageWithData:tempData];
 if(currentImages
 ==nil)
 {
 currentImages=[[NSMutableArray alloc]
 init];
 }
 [currentImages
 addObject:image];
 [_photosCollectionView
 reloadData];
 //
 [self saveImage:image withName:@""]
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController
 *)picker{
 [picker
 dismissViewControllerAnimated:YES completion:nil];
}
-
 (IBAction)cancelPost:(id)sender
 {
 [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)actionSheet:(UIActionSheet
 *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{

 switch (buttonIndex)
 {
 case 0:
  [self openCamera];
  break;
 case 1:
  [self openLibary];
  break;
  default:
  break;
 }
}
-(void)openCamera{
 //UIImagePickerControllerSourceType
 *type=UIImagePickerControllerSourceTypeCamera;
 if([UIImagePickerController
 isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
 {
  UIImagePickerController
 *picker=[[UIImagePickerController alloc] init];
  picker.delegate=self;
  picker.sourceType=UIImagePickerControllerSourceTypeCamera;
  picker.allowsEditing=YES;
  [self presentViewController:picker
 animated:YES completion:nil];

 }
}
-(void)openLibary{
 if([UIImagePickerController
 isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
 {
 UIImagePickerController
 *picker=[[UIImagePickerController alloc] init];
 picker.delegate=self;
 picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
 picker.allowsEditing=YES;
 [self presentViewController:picker
 animated:YES completion:nil];

 }

}
-(void)
 saveImage:(UIImage *)image withName:(NSString *)name
{
 NSData *imageData=UIImageJPEGRepresentation(image,
 0.5);
 NSString *path=[NSTemporaryDirectory()
 stringByAppendingPathComponent:name];
 [imageData
 writeToFile:path atomically:YES];

}
-
 (IBAction)DoubanSwitched:(id)sender
 {
 if(_DoubanSwitch.isOn){
 if(![UMSocialAccountManager
 isOauthAndTokenNotExpired:UMShareToDouban])
 {
  //进入授权页面
  [UMSocialSnsPlatformManager
 getSocialPlatformWithName:UMShareToDouban].loginClickHandler(self,[UMSocialControllerService
 defaultControllerService],YES,^(UMSocialResponseEntity
 *response){
  if (response.responseCode
 == UMSResponseCodeSuccess) {
   //获取微博用户名、uid、token等
   UMSocialAccountEntity
 *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToDouban];
   NSLog(@"username
 is %@, uid is %@, token is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken);
   //进入你的分享内容编辑页面
   UMSocialAccountEntity
 *doubanAccount = [[UMSocialAccountEntity alloc] initWithPlatformName:UMShareToDouban];
   doubanAccount.usid
 = snsAccount.usid;
   doubanAccount.accessToken
 = snsAccount.accessToken;
   //
 weiboAccount.openId = @"tencent weibo openId";  //腾讯微博账户必需设置openId
   //同步用户信息
   [UMSocialAccountManager
 postSnsAccount:doubanAccount completion:^(UMSocialResponseEntity *response){
   if (response.responseCode
 == UMSResponseCodeSuccess) {
    //在本地缓存设置得到的账户信息
    [UMSocialAccountManager
 setSnsAccount:doubanAccount];
    //进入你自定义的分享内容编辑页面或者使用我们的内容编辑页面
   }}];
  }
  else {
   [_DoubanSwitch
 setOn:NO animated:YES];
  }
  });
 }
 }
}

-
 (IBAction)RenrenSwitched:(id)sender
 {
 if(_DoubanSwitch.isOn)
 {
 if(![UMSocialAccountManager
 isOauthAndTokenNotExpired:UMShareToRenren])
 {
  //进入授权页面
  [UMSocialSnsPlatformManager
 getSocialPlatformWithName:UMShareToRenren].loginClickHandler(self,[UMSocialControllerService
 defaultControllerService],YES,^(UMSocialResponseEntity
 *response){
  if (response.responseCode
 == UMSResponseCodeSuccess) {
   //获取微博用户名、uid、token等
   UMSocialAccountEntity
 *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToRenren];
   NSLog(@"username
 is %@, uid is %@, token is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken);
   //进入你的分享内容编辑页面
   UMSocialAccountEntity
 *renrenAccount = [[UMSocialAccountEntity alloc] initWithPlatformName:UMShareToRenren];
   renrenAccount.usid
 = snsAccount.usid;
   renrenAccount.accessToken
 = snsAccount.accessToken;
   //
 weiboAccount.openId = @"tencent weibo openId";  //腾讯微博账户必需设置openId
   //同步用户信息
   [UMSocialAccountManager
 postSnsAccount:renrenAccount completion:^(UMSocialResponseEntity *response){
   if (response.responseCode
 == UMSResponseCodeSuccess) {
    //在本地缓存设置得到的账户信息
    [UMSocialAccountManager
 setSnsAccount:renrenAccount];
    //进入你自定义的分享内容编辑页面或者使用我们的内容编辑页面
   }}];
  }
  else{
   [_RenrenSwitch
 setOn:NO animated:YES];
  }
  });
 }

 }
}

-
 (IBAction)WeiboSwitched:(id)sender
 {
 if(_WeiboSwitch.isOn)
 {
 if(![UMSocialAccountManager
 isOauthAndTokenNotExpired:UMShareToSina])
 {
  [UMSocialSnsPlatformManager
 getSocialPlatformWithName:UMShareToSina].loginClickHandler(self,[UMSocialControllerService
 defaultControllerService],YES,^(UMSocialResponseEntity
 *response){
  if(response.responseCode==UMSResponseCodeSuccess){
   UMSocialAccountEntity
 *snsAccount=[[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToSina];
   UMSocialAccountEntity
 *sinaAccount=[[UMSocialAccountEntity alloc] initWithPlatformName:UMShareToSina];
   //缓存到本地
   sinaAccount.usid
 = snsAccount.usid;
   sinaAccount.accessToken
 = snsAccount.accessToken;
   //
 weiboAccount.openId = @"tencent weibo openId";  //腾讯微博账户必需设置openId
   //同步用户信息
   [UMSocialAccountManager
 postSnsAccount:sinaAccount completion:^(UMSocialResponseEntity *response){
   if (response.responseCode
 == UMSResponseCodeSuccess) {
    //在本地缓存设置得到的账户信息
    [UMSocialAccountManager
 setSnsAccount:sinaAccount];
    //进入你自定义的分享内容编辑页面或者使用我们的内容编辑页面
   }}];

  }
  else
  {
   [_WeiboSwitch
 setOn:NO animated:YES];
  }
  });
 }
 }
}

+(void)deleteSelectedImage:(NSInteger)index
{
 if(currentImages!=nil)
 [currentImages
 removeObjectAtIndex:index];
}
+(void)deleteSelectedImageWithImage:(UIImage
 *)image{
 if(currentImages!=nil)
 [currentImages
 removeObject:image];

}
@end

预览界面:

//
// YSYPreviewViewController.h
// NineShare
//
// Created by ZhangChangwei on 15/2/1.
// Copyright (c) 2015年 9Studio. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "PostTableViewController.h"

@interface YSYPreviewViewController : UIViewController<UIActionSheetDelegate>
+(void) setPreviewImage:(UIImage *)image;
@end
//
// YSYPreviewViewController.m
// NineShare
//
// Created by ZhangChangwei on 15/2/1.
// Copyright (c) 2015年 9Studio. All rights reserved.
//

#import "YSYPreviewViewController.h"
static UIImage *currentImage;
@interface YSYPreviewViewController ()
- (IBAction)deleteSelectedImage:(id)sender;
@property (weak, nonatomic) IBOutlet UIImageView *previewImageView;

@end

@implementation YSYPreviewViewController

- (void)viewDidLoad {
 [super viewDidLoad];
 // Do any additional setup after loading the view.
 _previewImageView.image=currentImage;
}

- (void)didReceiveMemoryWarning {
 [super didReceiveMemoryWarning];
 // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
}
*/

- (IBAction)deleteSelectedImage:(id)sender {
 UIActionSheet *action=[[UIActionSheet alloc] initWithTitle:@"要删除这张照片吗?" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"删除" otherButtonTitles: nil];
 [action showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
 if(buttonIndex==actionSheet.cancelButtonIndex)
 {
 return;
 }
 else
 {
 [PostTableViewController deleteSelectedImageWithImage:currentImage];
 [self.navigationController popToRootViewControllerAnimated:YES];
 }
}

+(void)setPreviewImage:(UIImage *)image{
 currentImage=image;
}
@end

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • iOS实现电商购物车界面示例

    先看界面效果图: 主要实现了商品的展示,并且可以对商品进行多选操作,以及改变商品的购买数量.与此同时,计算出,选中的总价格. 做此类型项目:要注意的:视图与数据要分离开来.视图的展现来源是数据模型层.所以我做的操作就是改变数据层的内容,在根据数据内容,去更新视图界面. 已下是具体实现思路与代码: 1. 实现步骤 在AppDelegate.m中包含ViewController.h头文件,创建ViewController对象(vc),接着创建一个UINavigationController对象(nV

  • 总结IOS界面间跳转的几种方法

    注意: 下面以FirstViewController(FVC)的按钮button点击后跳转到SecondViewController(SVC)为例说明: 方式一:Storyboard的segues方式 鼠标点击按钮button然后按住control键拖拽到SVC页面,在弹出的segue页面中选择跳转模式即可 优点:操作方便,无代码生成,在storyboard中展示逻辑清晰 缺点:页面较多时不方便查看,团队合作时可维护性差, 多人合作时不建议使用这种方式. 方式二:选项卡UITabBarContr

  • IOS 聊天界面(自适应文字)的实现

    该篇文章主要介绍一个实现聊天界面的思路过程,源码可以在 源码链接获得,该工程实现聊天的基本功能,功能还不够完善,欢迎大家提PR,效果图如下所示 我希望通过相对简单的方式实现界面的布局,没有复杂的计算达到自适应的效果. iOS8新功能介绍 虽然self size cell最终没有在我的工程中用到,但是这是我曾经挖过的坑,所以在此做了简单的介绍. 在iOS 8 中,UITableView新增一项功能 self size cells,这是一项通过 UITableViewCell 的约束自动自动计算UI

  • iOS高仿微信相册界面翻转过渡动画效果

    点开微信相册的时候,想要在相册图片界面跳转查看点赞和评论时,微信会采用界面翻转的过渡动画来跳转到评论界面,好像是在图片界面的背面一样,点击完成又会翻转回到图片界面,这不同于一般的导航界面滑动动画,觉得很有意思,于是自己学着做了一下,其实也很简单,下面是实现的类似的效果图: 在图片界面点击右下角的查看评论会翻转到评论界面,评论界面点击左上角的返回按钮会反方向翻转回图片界面,真正的实现方法,与传统的导航栏过渡其实只有一行代码的区别,让我们来看看整体的实现. 首先我们实现图片界面,这个界面上有黑色的背

  • iOS开发之级联界面(推荐界面)搭建原理

    先看看效果图: 一.整体布局  1.项目需求  点击左边cell,右边的cell数据更新  2.界面搭建  2.1交给两个控制器管理比较麻烦,点击一个控制器需要通知另外一个控制器  2. 2因此交给一个控制器管理比较好  2.3用xib搭建,左右各放一个tableView就可以了  3.开发顺序 先做左边的tableView,再做右边的,因为右边的数据是根据左边变化的  二.左边tableView界面搭建  1.自定义cell  左边一个指示器欧一个view   中间位置用label  2.设置

  • iOS图片界面翻页切换效果

    先看效果: 下面贴代码: #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *backgroundView; @property (strong,nonatomic) NSArray *array; @end @implementation ViewController -(NSArray *)array { if (_arra

  • Unity iOS混合开发界面切换思路解析

    思路 之前一篇文章里面只谈到了Unity和iOS工程的融合,并没有谈到iOS和Unity界面的切换,这里谈谈思路,Unity导出的iOS工程里面的结构大致是这样的,有一个Window,Window上有一个UnityView,但是并没有控制器,也没有根控制器,虽然在导出的iOS工程中Classes文件夹下的UnityAppController中有rootController的属性,但是上面也标注为空~ 所以,思路就只有一种,,既然Unity导出的iOS工程有一个Window并没有控制器,那好,混合

  • iOS制作带弹跳动画发布界面

    项目中经常会用到带弹跳动画发布界面,具体内容如下 效果图: 代码: // PublishView.m // UIImage+ImageEffects.h 苹果蒙化图片的分类 pop.h弹跳动画框架 EJExtension.h模型转换框架 // ComposeModel 用于设置按钮文字与图片的模型,在本地设置plist文件保存image(按钮图片)和text(按钮文字) #import "PublishView.h" #import "BSVerticalButton.h&q

  • iOS中使用UItableviewcell实现团购和微博界面的示例

    使用xib自定义UItableviewcell实现一个简单的团购应用界面布局 一.项目文件结构和plist文件 二.实现效果 三.代码示例 1.没有使用配套的类,而是直接使用xib文件控件tag值操作 数据模型部分: YYtg.h文件 复制代码 代码如下: // //  YYtg.h //  01-团购数据显示(没有配套的类) // //  Created by apple on 14-5-29. //  Copyright (c) 2014年 itcase. All rights reserv

  • IOS实现微信朋友圈相册评论界面的翻转过渡动画

    先来看看实现的类似效果图: 在图片界面点击右下角的查看评论会翻转到评论界面,评论界面点击左上角的返回按钮会反方向翻转回图片界面,真正的实现方法,与传统的导航栏过渡其实只有一行代码的区别,让我们来看看整体的实现. 首先我们实现图片界面,这个界面上有黑色的背景,一张图片和一个查看评论的按钮: - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor blackColor];// 背景设为黑色 //

随机推荐

其他