IOS常用第三方框架 - Rosie

本文介绍了iOS开发中常用的第三方框架,包括网络连接检测、网络请求、图片加载与缓存等功能强大的库,以及下拉刷新、上拉加载更多等UI组件。

IOS常用第三方框架 - Rosie

在iOS开发中不可避免的会用到一些第三方类库,它们提供了很多实用的功能,使我们的开发变得更有效率;同时,也可以从它们的源代码中学习到很多有用的东西。

Reachability 检测网络连接 

用来检查网络连接是否可用:包括WIFI和WWAN(3G/EDGE/CDMA等)两种工作模式。

现在有更好的替代品:https://github.com/tonymillion/Reachability,比Apple提供的兼容性更好,而且更加好用,更具体的使用方法请看它提供的例子。

Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];reach.reachableBlock = ^(Reachability*reach) {    NSLog(@"网络可用!");};reach.unreachableBlock = ^(Reachability*reach) {    NSLog(@"网络不可用!");};// 开始监听[reach startNotifier];

ASIHTTPRequest 网络请求 

ASIHTTPRequest是对CFNetwork API的一个包装,它提供了一套更加简洁的API,使用起来也更加简单。

官方网站:http://allseeing-i.com/ASIHTTPRequest/

GitHub:https://github.com/pokeb/asi-http-request

它不仅仅支持基本的HTTP请求,而且支持基于REST的服务(GET/POST/PUT/DELETE)。

最让人喜欢的是,它支持block语法:

NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];   __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];   [request setCompletionBlock:^{      // Use when fetching text data      NSString *responseString = [request responseString];       // Use when fetching binary data      NSData *responseData = [request responseData];   }];   [request setFailedBlock:^{      NSError *error = [request error];   }];   [request startAsynchronous];

它的ASIFormDataRequest子类可以横容易的提交表单数据和文件:

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];[request setPostValue:@"Ben" forKey:@"first_name"];[request setPostValue:@"Copsey" forKey:@"last_name"];// Upload a file on disk[request setFile:@"/Users/ben/Desktop/ben.jpg" withFileName:@"myphoto.jpg" andContentType:@"image/jpeg"forKey:@"photo"]; // Upload an NSData instance[request setData:imageData withFileName:@"myphoto.jpg" andContentType:@"image/jpeg" forKey:@"photo"];

详细的使用方法请下载相应的源代码及例子,或者从官方的使用说明http://allseeing-i.com/ASIHTTPRequest/How-to-use开始。

MBProgressHUD 提示效果 

支持各种状态加载的提示效果,以及带进度的提示效果。

GitHub:https://github.com/matej/MBProgressHUD

一般会在.m文件实现MBProgressHUDDelegate协议,并声明HUD变量:

@interface SampleViewController ()<MBProgressHUDDelegate>{    MBProgressHUD *HUD;}#pragma mark -#pragma mark MBProgressHUDDelegate methods- (void)hudWasHidden:(MBProgressHUD *)hud {	// Remove HUD from screen when the HUD was hidded	[HUD removeFromSuperview];	HUD = nil;}

在执行某个异步请求时开始调用:

HUD = [MBProgressHUD showHUDAddedTo:self.webView animated:YES];    HUD.labelText = @"正在请求...";    // mode参数可以控制显示的模式    //HUD.mode = MBProgressHUDModeText;    HUD.delegate = self;

请求完成时隐藏提示效果:

[HUD hide:YES];

对于同步方法一般都是用showWhileExecuting方法,方法执行完成之后会自动隐藏提示效果:

[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];

SVProgressHUD 提示效果 

GitHub:https://github.com/samvermette/SVProgressHUD

SVProgressHUD和MBProgressHUD效果差不多,不过不需要使用协议,同时也不需要声明实例。

直接通过类方法进行调用即可:

[SVProgressHUD method]

可以使用以下方法来显示状态:

+ (void)show;+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;+ (void)showWithStatus:(NSString*)string;+ (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType;

如果需要明确的进度,则使用以下方法:

+ (void)showProgress:(CGFloat)progress;+ (void)showProgress:(CGFloat)progress status:(NSString*)status;+ (void)showProgress:(CGFloat)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;

通过dismiss方法来隐藏提示:

+ (void)dismiss;

另外提供了以下方法用于显示状态,并在1秒后自动隐藏提示(使用的图标来源于Glyphish:http://www.glyphish.com/):

+ (void)showSuccessWithStatus:(NSString*)string;+ (void)showErrorWithStatus:(NSString *)string;+ (void)showImage:(UIImage*)image status:(NSString*)string; // use 28x28 white pngs

ZAActivityBar 提示效果 

GitHub:https://github.com/zacaltman/ZAActivityBar

ZAActivityBar和SVProgressHUD非常相似,它提供了更加简洁的API来显示提示效果。

ZAActivityBar使用的动画效果来源于ZKBounceAnimation(https://github.com/khanlou/SKBounceAnimation),成功、失败的状态图标来源于Pictos(http://pictos.cc/)。

显示加载状态:

[ZAActivityBar showWithStatus:@"加载中..."];

显示成功、失败状态:

[ZAActivityBar showSuccessWithStatus:@"成功!"];[ZAActivityBar showErrorWithStatus:@"失败!"];

隐藏提示:

[ZAActivityBar dismiss];

官方: http://sbjson.org/

GitHub:https://github.com/stig/json-framework

API使用起来稍显繁琐,特别是初始化的时候:

@interface TestViewController ()<SBJsonStreamParserAdapterDelegate> {    SBJsonStreamParser *parser;    SBJsonStreamParserAdapter *adapter;}// 冗长的初始化方法足以吓到一大片人- (void)initSBJSON{    // We don't want *all* the individual messages from the	// SBJsonStreamParser, just the top-level objects. The stream	// parser adapter exists for this purpose.	adapter = [[SBJsonStreamParserAdapter alloc] init];		// Set ourselves as the delegate, so we receive the messages	// from the adapter.	adapter.delegate = self;		// Create a new stream parser..	parser = [[SBJsonStreamParser alloc] init];		// .. and set our adapter as its delegate.	parser.delegate = adapter;		// Normally it's an error if JSON is followed by anything but	// whitespace. Setting this means that the parser will be	// expecting the stream to contain multiple whitespace-separated	// JSON documents.	parser.supportMultipleDocuments = YES;}#pragma mark SBJsonStreamParserAdapterDelegate methods- (void)parser:(SBJsonStreamParser *)parser foundArray:(NSArray *)array {    [NSException raise:@"unexpected" format:@"Should not get here"];}- (void)parser:(SBJsonStreamParser *)parser foundObject:(NSDictionary *)dict {    NSLog(@"SBJson parser foundObject");    // 处理返回的数据}// 使用ASIHTTPRequest请求测试- (void) loadData {    __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];    [request setRequestMethod:@"POST"];    [request setCompletionBlock:^{        // Use when fetching text data        //NSString *responseString = [request responseString];        // Use when fetching binary data        NSData *responseData = [request responseData];        NSLog(@"Connection didReceiveData of length: %u", responseData.length);                // Parse the new chunk of data. The parser will append it to        // its internal buffer, then parse from where it left off in        // the last chunk.        SBJsonStreamParserStatus status = [parser parse:responseData];                if (status == SBJsonStreamParserError) {            NSLog(@"Parser error: %@", parser.error);        } else if (status == SBJsonStreamParserWaitingForData) {            NSLog(@"Parser waiting for more data");        }    }];    [request setFailedBlock:^{        NSError *error = [request error];        NSLog(@"failed - %@ %@", [error localizedDescription], error);    }];    [request startAsynchronous];}

GitHub:https://github.com/johnezang/JSONKit

提供比SBJson更优异的性能以及更加简便的使用方法,但是中文最好使用utf-8格式(/uXXXX),否则容易造成乱码。

API调用起来非常简单,省去了SBJson那么一大堆的方法:

JSONDecoder* decoder = [[JSONDecoder alloc] initWithParseOptions:JKParseOptionNone];id result = [decoder objectWithData:jsonData];

详细的使用方法请看它的GitHub主页。

SDWebImage 图片异步加载及缓存 

SDWebImage用于异步下载网络上的图片,并支持对图片的缓存等。

多数情况下是使用UIImageView+WebCache为UIImageView异步加载图片:

#import <SDWebImage/UIImageView+WebCache.h>// ...[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]                   placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

需要注意的是,pladeholderImage的大小一定要大于UIImageView的大小,否则可能不显示placeholderImage图片。

它还支持block语法用于在加载完成时做一些操作:

[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]               placeholderImage:[UIImage imageNamed:@"placeholder.png"]                      completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {... completion code here ...}];

SDWebImage并不局限于UIImageView上,使用SDWebImageManager完成更多的操作:

SDWebImageManager *manager = [SDWebImageManager sharedManager];[manager downloadWithURL:imageURL                 options:0                 progress:^(NSUInteger receivedSize, long long expectedSize)                 {                     // 下载进度                 }                 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)                 {                     if (image)                     {                         // 下载完成                     }                 }];

或者使用Image Downloader也是一样的效果:

[SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageURL        options:0       progress:^(NSUInteger receivedSize, long long expectedSize)       {           // 进度       }       completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished)       {           if (image && finished)           {               // 下载完成           }       }];

UIActivityIndicator-for-SDWebImage 为SDWebImage显示加载效果 

GitHub:https://github.com/JJSaccolo/UIActivityIndicator-for-SDWebImage

用于为SDWebImage在UIImageView加载图片时,显示加载效果(UIActivityIndicatorView实现),它提供以下方法:

- (void)setImageWithURL:(NSURL *)url usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

UIImage+Resize 调整图片大小 

GitHub:https://github.com/coryalder/UIImage_Resize

提供多种方法为图片设置透明度、圆角、裁剪、调整大小等:

- (UIImage *)imageWithAlpha;- (UIImage *)transparentBorderImage:(NSUInteger)borderSize;- (UIImage *)roundedCornerImage:(NSInteger)cornerSize borderSize:(NSInteger)borderSize;- (UIImage *)croppedImage:(CGRect)bounds;- (UIImage *)thumbnailImage:(NSInteger)thumbnailSize          transparentBorder:(NSUInteger)borderSize               cornerRadius:(NSUInteger)cornerRadius       interpolationQuality:(CGInterpolationQuality)quality;- (UIImage *)resizedImage:(CGSize)newSize     interpolationQuality:(CGInterpolationQuality)quality;- (UIImage *)  resizedImageWithContentMode:(UIViewContentMode)contentMode                       bounds:(CGSize)bounds         interpolationQuality:(CGInterpolationQuality)quality;

更详细使用见:http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

ImageCacheResize 异步加载图片、缓存及调整大小 

GitHub:https://github.com/toptierlabs/ImageCacheResize

整合了SDWebImage和UIImage+Resize的功能,用于图片的异步加载、缓存、以及下载完成后调整大小并显示在UIImageView上。

提供了以下API用于加载图片以及加载完成后调整图片大小:

- (void)setImageWithURL:(NSURL *)url andCropToBounds:(CGRect)bounds;- (void)setImageWithURL:(NSURL *)url andResize:(CGSize)size withContentMode:(UIViewContentMode)mode;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder andCropToBounds:(CGRect)bounds;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options  andResize:(CGSize)size;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options  andResize:(CGSize)size withContentMode:(UIViewContentMode)mode;- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options  andCropToBounds:(CGRect)bounds;

使用方法和SDWebImage一样简单,如以下官方例子:

[imageview setImageWithURL:[NSURL URLWithString:@"http://t0.gstatic.com/images?q=tbn:ANd9GcQfraHpiabjEY8iDdBe9OUQYHMtwfuAv9ZRR0RYKuoVF_EpE8Fp5A"] andResize:CGSizeMake(30, 30) withContentMode:UIViewContentModeScaleAspectFit]; // 按比例缩放[imageview setImageWithURL:[NSURL URLWithString:@"http://t0.gstatic.com/images?q=tbn:ANd9GcQfraHpiabjEY8iDdBe9OUQYHMtwfuAv9ZRR0RYKuoVF_EpE8Fp5A"] andCropToBounds:CGRectMake(0, 0, 100, 100)]; // 裁剪成100x100大小

EGOTableViewPullRefresh  下拉刷新 

GitHub:https://github.com/enormego/EGOTableViewPullRefresh

这是最早出现的为UITableView提供下拉刷新功能的类库,使用起来稍显麻烦,需要实现诸多协议(代码取自官方DEMO):

#import "EGORefreshTableHeaderView.h"@interface RootViewController : UITableViewController  <EGORefreshTableHeaderDelegate, UITableViewDelegate, UITableViewDataSource>{	EGORefreshTableHeaderView *_refreshHeaderView;	//  是否正在加载中 	BOOL _reloading;}- (void)viewDidLoad {    [super viewDidLoad];    	if (_refreshHeaderView == nil) {		EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.height, self.view.frame.size.width, self.tableView.bounds.size.height)];		view.delegate = self;		[self.tableView addSubview:view];		_refreshHeaderView = view;		[view release];	}	//  更新最后加载时间	[_refreshHeaderView refreshLastUpdatedDate];}#pragma mark -#pragma mark Data Source Loading / Reloading Methods- (void)reloadTableViewDataSource{	//  在这里加入代码用于获取数据	_reloading = YES;}- (void)doneLoadingTableViewData{	//  数据加载完成时调用这个方法	_reloading = NO;	[_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];}#pragma mark -#pragma mark UIScrollViewDelegate Methods- (void)scrollViewDidScroll:(UIScrollView *)scrollView{		[_refreshHeaderView egoRefreshScrollViewDidScroll:scrollView];}- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{	[_refreshHeaderView egoRefreshScrollViewDidEndDragging:scrollView];}#pragma mark -#pragma mark EGORefreshTableHeaderDelegate Methods- (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view{	[self reloadTableViewDataSource];	[self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];}- (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view{	return _reloading; // should return if data source model is reloading}- (NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view{	return [NSDate date]; // should return date data source was last changed}

PullToRefresh 下拉刷新 

GitHub:https://github.com/leah/PullToRefresh

PullToRefresh提供比EGOTableViewPullRefresh更加简单的使用方法,只要继承自PullRefreshTableViewController,再实现refresh方法即可:

- (void)refresh {    // 加载数据    [self.tableView reloadData]; // 重新载入UITableView    [self stopLoading]; //停止动画}

STableViewController  下拉刷新、上拉加载更多 

GitHub:https://github.com/shiki/STableViewController

STableViewController比PullToRefresh多了一个上拉加载更多功能,使用上也差不多简单,需要继承自STableViewController,再实现一些方法:

- (void) viewDidLoad{  [super viewDidLoad];    self.title = @"STableViewController Demo";  [self.tableView setBackgroundColor:[UIColor lightGrayColor]];    // 需要创建两个自定义视图用于显示"下拉刷新""上拉加载更多"  self.headerView = headerView;    self.footerView = footerView;  }#pragma mark - Pull to Refresh- (void) pinHeaderView{  [super pinHeaderView];    // 下拉刷新视图显示一些加载动画}- (void) unpinHeaderView{  [super unpinHeaderView];    // 下拉刷新视图停止动画}- (void) headerViewDidScroll:(BOOL)willRefreshOnRelease scrollView:(UIScrollView *)scrollView{  // 下拉刷新视图显示状态信息  if (willRefreshOnRelease)    //hv.title.text = @"松开后刷新...";  else    //hv.title.text = @"下拉刷新...";}- (BOOL) refresh{  if (![super refresh])    return NO;    // 下拉刷新加载数据  [self performSelector:@selector(addItemsOnTop) withObject:nil afterDelay:2.0];  return YES;}#pragma mark - Load More- (void) willBeginLoadingMore{  // 上拉加载更多视图加载动画}- (void) loadMoreCompleted{  [super loadMoreCompleted];  // 上拉加载更多视图停止动画    if (!self.canLoadMore) {    //没有更多数据的时候执行代码...  }}- (BOOL) loadMore{  if (![super loadMore])    return NO;    // 上拉加载更多数据  [self performSelector:@selector(addItemsOnBottom) withObject:nil afterDelay:2.0];  return YES;}// - (void) addItemsOnTop{  // 加载数据...    [self.tableView reloadData];    // 数据加载完成通知上拉视图  [self refreshCompleted];}- (void) addItemsOnBottom{  // 加载更多数据...  [self.tableView reloadData];    // 通过判断设置是否可以加载更多  //self.canLoadMore = NO;    // 数据加载完成通知下拉视图  [self loadMoreCompleted];}

SVPullToRefresh 下拉刷新、上拉加载更多 

GitHub:https://github.com/samvermette/SVPullToRefresh

包含SVPullToRefresh + SVInfiniteScrolling为UITableView提供下拉刷新、上拉加载更多功能。

使用起来也相当简单,只要在UITableViewController里实现以下方法:

- (void)viewDidLoad {    [super viewDidLoad];    __weak SVViewController *weakSelf = self;        // 设置下拉刷新    [self.tableView addPullToRefreshWithActionHandler:^{        [weakSelf insertRowAtTop];    }];            // 设置上拉加载更多    [self.tableView addInfiniteScrollingWithActionHandler:^{        [weakSelf insertRowAtBottom];    }];}- (void)viewDidAppear:(BOOL)animated {    [tableView triggerPullToRefresh];}- (void)insertRowAtTop {    // 获取数据....        // 停止动画    [self.tableView.pullToRefreshView stopAnimating];}- (void)insertRowAtBottom {    // 获取数据....        // 停止动画    [weakSelf.tableView.infiniteScrollingView stopAnimating];}

CMPopTipView 提示信息 

GitHub:https://github.com/chrismiles/CMPopTipView

CMPopTipView用于在一些视图上显示提示信息:

self.tipView = [[CMPopTipView alloc] initWithMessage:@"提示消息"];self.tipView.delegate = self;[self.tipView presentPointingAtView:anyButton inView:self.view animated:YES]; // 点击按钮显示[self.tipView presentPointingAtBarButtonItem:barButtonItem animated:YES]; // 点击导航栏按钮显示    #pragma mark CMPopTipViewDelegate methods- (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {  // 清理资源  self.tipView = nil;}

GitHub:https://github.com/vicpenap/PrettyKit

定制了一些UI组件如UITableViewCell、UINavigationBar、UITabBar、UIToolBar等,比系统自带的更加美观。

GitHub:https://github.com/sobri909/MGBox2

提供一些定制的UI组件可以更简单快速的创建表格、网格布局,以及丰富的文本呈现,基于block的事件机制等,包含:MGBox、MGTableBox、MGTableBoxStyled、MGScrollView、MGButton、MGEvents、MGEasyFrame、MGLine等,其中MGBox还支持screenshot方法用于截图。

GitHub:https://github.com/jverkoey/nimbus

著名的框架,提供了一套非常丰富的UI组件,可以使开发变得更加简单、有效率。

GitHub:https://github.com/Grouper/FlatUIKit

扁平化设计的UI组件,类似于WP或者iOS7的风格。

GitHub:https://github.com/muccy/MUKMediaGallery

媒体库效果,支持图片、视频及音频。

PTShowcaseViewController 

GitHub:https://github.com/exalted/PTShowcaseViewController

同样是一个媒体库效果,支持的格式更多,包括:图片、视频、PDF等.

GitHub:https://github.com/mwaterfall/MWPhotoBrowser

图片展示效果,支持本地及远程的图片,使用也比较简单,只要实现MWPhotoBrowserDelegate协议:

@interface TestViewController ()<MWPhotoBrowserDelegate>{    NSArray *_photos;}-(void) doAction {        NSMutableArray *photos = [[NSMutableArray alloc] init];        for (...) {            MWPhoto* photo = [MWPhoto photoWithURL:[NSURL URLWithString:url]]; // 设置图片地址            photo.caption = description; // 设置描述            [photos addObject:photo];        }        _photos = photos;        MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];        browser.displayActionButton = YES;                UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:browser];        nc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;        [self presentModalViewController:nc animated:YES];}#pragma mark - MWPhotoBrowserDelegate- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser {    return _photos.count;}- (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {    if (index < _photos.count)        return [_photos objectAtIndex:index];    return nil;}

ios-image-filters 

GitHub:https://github.com/esilverberg/ios-image-filters

提供多种图片滤镜效果。

PDF Reader Core for iOS 

GitHub:https://github.com/vfr/Reader

PDF阅读器核心。

GitHub:https://github.com/Cocoanetics/DTCoreText

支持富文本的显示如HTML。

GitHub:https://github.com/FuerteInternational/FTCoreText

富文本视图

GitHub:https://github.com/akosma/CoreTextWrapper

支持多列的文本视图

GitHub:https://github.com/nicklockwood/Base64

提供对字符串的Base64编码

GitHub:https://github.com/rnapier/RNCryptor

提供AES加密方法

多源动态最优潮流的分布鲁棒优化方法(IEEE118节点)(Matlab代码实现)内容概要:本文介绍了基于Matlab实现的多源动态最优潮流的分布鲁棒优化方法,适用于IEEE118节点电力系统。该方法旨在应对电力系统中源荷不确定性带来的挑战,通过构建分布鲁棒优化模型,有效处理多源输入下的动态最优潮流问题,提升系统运行的安全性和经济性。文中详细阐述了模型的数学 formulation、求解算法及仿真验证过程,并提供了完整的Matlab代码实现,便于读者复现与应用。该研究属于电力系统优化调度领域的高水平技术复现,具有较强的工程实用价值。; 适合人群:具备电力系统基础知识和Matlab编程能力的研究生、科研人员及从事电力系统优化调度的工程技术人员,尤其适合致力于智能电网、鲁棒优化、能源调度等领域研究的专业人士。; 使用场景及目标:①用于电力系统多源环境下动态最优潮流的建模与求解;②支撑含可再生能源接入的电网调度决策;③作为鲁棒优化方法在实际电力系统中应用的教学与科研案例;④为IEEE118节点系统的仿真研究提供可复现的技术支持。; 阅读建议:建议结合提供的Matlab代码逐模块分析,重点关注不确定变量的分布鲁棒建模、目标函数构造及求解器调用方式。读者应具备一定的凸优化和电力系统分析基础,推荐配合YALMIP工具包与主流求解器(如CPLEX、Gurobi)进行调试与扩展实验。
内容概要:本文系统介绍了物联网与云计算的基本概念、发展历程、技术架构、应用场景及产业生态。文章阐述了物联网作为未来互联网的重要组成部分,通过RFID、传感器网络、M2M通信等技术实现物理世界与虚拟世界的深度融合,并展示了其在智能交通、医疗保健、能源管理、环境监测等多个领域的实际应用案例。同时,文章强调云计算作为物联网的支撑平台,能够有效应对海量数据处理、资源弹性调度和绿色节能等挑战,推动物联网规模化发展。文中还详细分析了物联网的体系结构、标准化进展(如IEEE 1888、ITU-T、ISO/IEC等)、关键技术(中间件、QoS、路由协议)以及中国运营商在M2M业务中的实践。; 适合人群:从事物联网、云计算、通信网络及相关信息技术领域的研究人员、工程师、高校师生以及政策制定者。; 使用场景及目标:①了解物联网与云计算的技术融合路径及其在各行业的落地模式;②掌握物联网体系结构、标准协议与关键技术实现;③为智慧城市、工业互联网、智能物流等应用提供技术参考与方案设计依据;④指导企业和政府在物联网战略布局中的技术选型与生态构建。; 阅读建议:本文内容详实、覆盖面广,建议结合具体应用场景深入研读,关注技术标准与产业协同发展趋势,同时结合云计算平台实践,理解其对物联网数据处理与服务能力的支撑作用。
标题基于Java的停车场管理系统设计与实现研究AI更换标题第1章引言介绍停车场管理系统研究背景、意义,分析国内外现状,阐述论文方法与创新点。1.1研究背景与意义分析传统停车场管理问题,说明基于Java系统开发的重要性。1.2国内外研究现状综述国内外停车场管理系统的发展现状及技术特点。1.3研究方法以及创新点介绍本文采用的研究方法以及系统开发中的创新点。第2章相关理论总结Java技术及停车场管理相关理论,为系统开发奠定基础。2.1Java编程语言特性阐述Java的面向对象、跨平台等特性及其在系统开发中的应用。2.2数据库管理理论介绍数据库设计原则、SQL语言及在系统中的数据存储与管理。2.3软件工程理论说明软件开发生命周期、设计模式在系统开发中的运用。第3章基于Java的停车场管理系统设计详细介绍系统的整体架构、功能模块及数据库设计方案。3.1系统架构设计阐述系统的层次结构、模块划分及模块间交互方式。3.2功能模块设计介绍车辆进出管理、车位管理、计费管理等核心功能模块设计。3.3数据库设计给出数据库表结构、字段设计及数据关系图。第4章系统实现与测试系统实现过程,包括开发环境、关键代码及测试方法。4.1开发环境与工具介绍系统开发所使用的Java开发环境、数据库管理系统等工具。4.2关键代码实现展示系统核心功能的部分关键代码及实现逻辑。4.3系统测试方法与结果阐述系统测试方法,包括单元测试、集成测试等,并展示测试结果。第5章研究结果与分析呈现系统运行效果,分析系统性能、稳定性及用户满意度。5.1系统运行效果展示通过截图或视频展示系统实际操作流程及界面效果。5.2系统性能分析从响应时间、吞吐量等指标分析系统性能。5.3用户满意度调查通过问卷调查等方式收集用户反馈,分析用户满意度。第6章结论与展望总结研究成果,提出系统改进方向及未来发展趋势。6.1研究结论概括基于Java的停车场管理
根据原作 https://pan.quark.cn/s/a4b39357ea24 的源码改编 QT作为一个功能强大的跨平台应用程序开发框架,为开发者提供了便利,使其能够借助C++语言编写一次代码,便可在多个操作系统上运行,例如Windows、Linux、macOS等。 QT5.12是QT框架中的一个特定版本,该版本引入了诸多改进与新增特性,包括性能的提升、API支持的扩展以及对现代C++标准的兼容性。 在QT5.12环境下实现后台对鼠标侧键的监控,主要涉及以下几个关键知识点:1. **信号与槽(Signals & Slots)机制**:这一机制是QT的核心,主要用于实现对象之间的通信。 在监测鼠标事件时,可以通过定义信号和槽函数来处理鼠标的点击行为,比如,当鼠标侧键被触发时,会触发一个信号,然后将其连接至相应的槽函数以执行处理。 2. **QEvent类**:在QT中,QEvent类代表了多种类型的事件,涵盖了键盘事件、鼠标事件等。 在处理鼠标侧键时,需要关注`QEvent::MouseButtonPress`和`QEvent::MouseButtonRelease`事件,尤其是针对鼠标侧键的独特标识。 3. **QMouseEvent类**:每当鼠标事件发生,系统会发送一个QMouseEvent对象。 通过这个对象,可以获取到鼠标的按钮状态、位置、点击类型等信息。 在处理侧键时,可以检查`QMouseEvent::button()`返回的枚举值,例如`Qt::MiddleButton`表示的是鼠标中键(即侧键)。 4. **安装事件过滤器(Event Filter)**:为了在后台持续监控鼠标,可能需要为特定的窗口或对象安装事件过滤器。 通过实现`QObject::eventFilter...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值