- 浏览: 2534035 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
jsntghf:
peio 写道这个怎么运行?Ruby On Rails的环境搭 ...
多文件上传之uploadify -
peio:
这个怎么运行?
多文件上传之uploadify -
往事如烟1:
我的项目是自己init了一个原始的project,之后将ver ...
React Native热部署之CodePush -
jsntghf:
往事如烟1 写道我按照你的说明进行,发现app退出之后,在进入 ...
React Native热部署之CodePush -
往事如烟1:
我按照你的说明进行,发现app退出之后,在进入不正确,请问是什 ...
React Native热部署之CodePush
以前写了一篇文章:UISplitView的简单示例,这篇文章实现的功能类似,具体的实现请参考附件。
SplitViewTestAppDelegate.h
#import <UIKit/UIKit.h> @class RootViewController; @class DetailViewController; @interface SplitViewTestAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UISplitViewController *splitViewController; RootViewController *rootViewController; DetailViewController *detailViewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController; @property (nonatomic, retain) IBOutlet RootViewController *rootViewController; @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; @end
SplitViewTestAppDelegate.m
#import "SplitViewTestAppDelegate.h" #import "RootViewController.h" #import "DetailViewController.h" @implementation SplitViewTestAppDelegate @synthesize window, splitViewController, rootViewController, detailViewController; #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:splitViewController.view]; [window makeKeyAndVisible]; return YES; } #pragma mark - #pragma mark Memory management - (void)dealloc { [splitViewController release]; [window release]; [super dealloc]; } @end
RootViewController.h
#import <UIKit/UIKit.h> @class DetailViewController; @interface RootViewController : UITableViewController { DetailViewController *detailViewController; NSMutableArray *fruits; } @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; @property (nonatomic, retain) NSMutableArray *fruits; @end
RootViewController.m
#import "RootViewController.h" #import "DetailViewController.h" @implementation RootViewController @synthesize detailViewController; @synthesize fruits; #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; self.title = @"List of Fruits"; self.clearsSelectionOnViewWillAppear = NO; self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); self.fruits = [[NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"fruits" ofType:@"plist"]] retain]; } #pragma mark - #pragma mark Table view data source - (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section { return [fruits count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CellIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryNone; } cell.textLabel.text = [self.fruits objectAtIndex:indexPath.row]; return cell; } #pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { detailViewController.detailItem = [self.fruits objectAtIndex:indexPath.row]; } #pragma mark - #pragma mark Memory management - (void)dealloc { [self.fruits release]; [detailViewController release]; [super dealloc]; } @end
DetailViewController.h
#import <UIKit/UIKit.h> @interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate> { UIPopoverController *popoverController; UINavigationBar *navigationBar; id detailItem; UILabel *detailDescriptionLabel; IBOutlet UIImageView *fruitImageView; } @property (nonatomic, retain) IBOutlet UINavigationBar *navigationBar; @property (nonatomic, retain) id detailItem; @property (nonatomic, retain) IBOutlet UILabel *detailDescriptionLabel; @property (nonatomic, retain) IBOutlet UIImageView *fruitImageView; @end
DetailViewController.m
#import "DetailViewController.h" #import "RootViewController.h" @interface DetailViewController () @property (nonatomic, retain) UIPopoverController *popoverController; - (void)configureView; @end @implementation DetailViewController @synthesize navigationBar, popoverController, detailItem, detailDescriptionLabel, fruitImageView; #pragma mark - #pragma mark Managing the detail item - (void)setDetailItem:(id)newDetailItem { if (detailItem != newDetailItem) { [detailItem release]; detailItem = [newDetailItem retain]; navigationBar.topItem.title = detailItem; NSString *imageName = [NSString stringWithFormat:@"%@.png", detailItem]; [self.fruitImageView setImage:[UIImage imageNamed:imageName]]; [self configureView]; } if (popoverController != nil) { [popoverController dismissPopoverAnimated:YES]; } } - (void)configureView { detailDescriptionLabel.text = [detailItem description]; } #pragma mark - #pragma mark Split view support - (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc { barButtonItem.title = @"Master List"; [navigationBar.topItem setLeftBarButtonItem:barButtonItem animated:YES]; self.popoverController = pc; } - (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { [navigationBar.topItem setLeftBarButtonItem:nil animated:YES]; self.popoverController = nil; } - (void)viewDidUnload { self.popoverController = nil; } #pragma mark - #pragma mark Memory management - (void)dealloc { [popoverController release]; [navigationBar release]; [detailItem release]; [detailDescriptionLabel release]; [super dealloc]; } @end
效果图:
- SplitViewTest.zip (2.8 MB)
- 下载次数: 22
发表评论
-
Error watching file for changes: EMFILE
2016-12-15 11:57 1302执行npm start后报错: Error watc ... -
CocoaPods升级1.1.1报错
2016-12-15 08:39 795ERROR: While executing gem .. ... -
Visual Studio Code运行React Native报错
2016-06-13 09:43 1614React Native:0.27.2 React:15 ... -
React Native 0.27.2编译报错this._nativeModule.addListener is not a function
2016-06-12 15:21 3858React Native:0.27.2 React:15 ... -
Unable to resolve module ReactDefaultPerf from
2016-06-02 13:04 2787package.json信息如下: "reac ... -
React Native 0.26.2编译报错Undefined symbols for architecture x86_64
2016-05-26 11:15 2020React Native:0.26.2 React:15. ... -
Failed to update auto layout status: Failed to load designables from path (null)
2016-04-05 22:11 1715确保CocoaPods是0.36.1以上版本,然后在podf ... -
集成微信支付出现Undefined symbols for architecture x86_64错误
2016-03-21 13:22 1751Undefined symbols for architec ... -
React Native热部署之CodePush
2016-01-10 22:27 6247本文使用的环境是Mac OS 10.11.1、Xcode ... -
浅谈React Native中的FlexBox布局
2015-11-17 18:38 4307React Native通过一个基于FlexBox的布局引 ... -
React Native之构建一个简单的列表页
2015-10-23 14:45 2166本文中我们将创建一个简单的电影应用,这个应用将从Rotten ... -
React Native之环境搭建
2015-10-20 16:30 1447本文使用的环境是Mac O ... -
获取图片属性的方法
2015-10-18 20:43 3145很多时候我们需要获 ... -
NSCache的下标用法
2015-09-18 00:19 1216NSCache类和NSDictionary类很相似,也提供 ... -
如何给category添加属性
2015-08-16 10:41 693主要是使用了runtime中的associative机制。 ... -
UITableView的两种重用Cell方法的区别
2015-08-10 13:07 16149UITableView中有两种重用Cell的方法: - ... -
SDImageCache.m报错Unused variable 'fileName'
2015-08-04 21:56 1175GCC手册中的相关解释: unused:This att ... -
Swift调用Objective-C
2015-07-13 23:33 1228Swift调用Objective-C需要一个名为<工程 ... -
使用GCD实现倒计时
2015-07-24 21:47 1085__block int timeout = 60; // ... -
导航栏加分割线的实现
2015-07-01 22:00 1763self.view.backgroundColor = [U ...
相关推荐
axure示例,简单示例,图片轮播,菜单选择,很简单的示例。 只有一个首页的图片轮播效果,和菜单选择效果。不喜勿喷。
HibernateTemplate的简单示例
在自己C++代码中使用openpose的简单示例,有助于灵活的使用openpose而不是简单的运行官方demo
超简单AIoT物联网与网站假设必学神器:Node-RED视觉化开发工具配套示例代码 超简单AIoT物联网与网站假设必学神器:Node-RED视觉化开发工具配套示例代码 超简单AIoT物联网与网站假设必学神器:Node-RED视觉化开发工具...
简单的全局钩子使用示例 包含两部分: 1.一个DLL用来写全局钩子(鼠标钩子用来把鼠标限定在某个区域中和键盘钩子用来钩小键盘的数据“0”和ALT+F用来决定是否把鼠标限定在区域中), 2.一个TESTDLL单文档结构的...
基于SpringCloud的微服务简易示例代码
hibernate-3.4入门的简单示例,用注解的方式操作oracle数据库。源码导入可运行。 还包括hibernate-annotations-3.4.0.GA.zip、hibernate-distribution-3.3.2.GA-dist.zip、slf4j-1.5.8.zip、ojdbc14.jar
linux 网络编程 epoll 简单示例 客户端 源码 只为学习epoll用 有不妥之处欢迎指正
vs2008 sql server 2005 C# 网上投票简单示例 vs2008 sql server 2005 C# 网上投票简单示例 vs2008 sql server 2005 C# 网上投票简单示例 vs2008 sql server 2005 C# 网上投票简单示例
小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss示例小程序直传oss...
单片机开发简单示例教程,基础入门教学示例,LED闪烁程序,温度传感器读取程序示例等
"google 示例google 示例google 示例google 示例"的描述虽然重复,但我们可以从中推测,这些示例可能涵盖了多个使用场景,可能是为了帮助开发者更好地理解和应用Google的技术。这可能包括搜索API、地图API、身份验证...
演示如何简单的调用WOSA/XFS的简单的实例
extjs 2.0简单示例,不全,基本上可以知道是什么东西。
代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG商店系统简单示例代码 RPG...
Access自带的示例数据库-罗斯文数据库
表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别示例代码表格识别...
NULL 博文链接:https://dr-yanglong.iteye.com/blog/1967574
NULL 博文链接:https://cwj158.iteye.com/blog/1181768
MyEclipse 中 Ajax简单示例