随笔分类 -  iphone

摘要:url:samvermette_SVWebViewControllerThree20带此浏览方式,如果只需要单一功能,不需要添加整个320项目。源码包demo方法:- (void)pushWebViewController { NSURL *URL = [NSURL URLWithString:@"http://www.cnblogs.com/maxfong/"]; SVWebViewController *webViewController = [[SVWebViewController alloc] initWithURL:URL]; [self.navigationC 阅读全文
posted @ 2012-05-15 14:01 Maxfong 阅读(4796) 评论(0) 推荐(0)
摘要:添加AVFoundation.framework 和MediaPlayer.framework。在NavView.h文件中,添加:#import<AVFoundation/AVFoundation.h>#import<MediaPlayer/MediaPlayer.h>@interfaceNavView1:UIViewController<AVAudioPlayerDelegate>{AVAudioPlayer*audioPlayer;MPMoviePlayerController*moviePlayer;}@end在init中添加音乐url:-(id)in 阅读全文
posted @ 2012-05-14 13:25 Maxfong 阅读(546) 评论(0) 推荐(0)
摘要:nav添加左按钮:-(void)viewDidLoad{//...UIBarButtonItem*tableEditBtn=[[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdittarget:selfaction:@selector(toggleEdit:)];[[selfnavigationItem]setLeftBarButtonItem:tableEditBtn];[tableEditBtnrelease];}edit按钮的实现:-(void)toggleEdit:(id)sender{i. 阅读全文
posted @ 2012-05-10 09:27 Maxfong 阅读(220) 评论(0) 推荐(0)
摘要:归档TableViewController的data。为了在Nav上添加Add按钮,为TableViewController创建UINavigationController://FirstAppAppDelegate.h@classTableViewController;@interfaceFirstAppAppDelegate:NSObject<UIApplicationDelegate>{TableViewController*tableTab;//为了能执行数据保存}//FirstAppAppDelegate.m内,不详细写-(BOOL)application:(UIAppl 阅读全文
posted @ 2012-05-09 14:04 Maxfong 阅读(446) 评论(0) 推荐(0)
摘要:添加Rotation文件,用类别为UITabBarController添加旋转://Rotation.h文件#import<Foundation/Foundation.h>@interfaceUITabBarController(Rotation)-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)x;@endRotation.m文件:#import"Rotation.h"@implementationUITabBarController(Rotation)-(BOOL)sh 阅读全文
posted @ 2012-05-08 09:38 Maxfong 阅读(216) 评论(0) 推荐(0)
摘要:创建TableViewCell文件(继承于UITableViewCell),在.h文件中添加2个label和一个方法:@interfaceTableViewCell:UITableViewCell{UILabel*nameLbl;UILabel*ageLbl;}-(void)setValue:(NSString*)nameage:(NSString*)age;创建子视图://增加了2个label-(id)initWithStyle:(UITableViewCellStyle)stylereuseIdentifier:(NSString*)reuseIdentifier{self=[superi 阅读全文
posted @ 2012-05-07 16:53 Maxfong 阅读(604) 评论(0) 推荐(0)
摘要:首先需要一个Nav,在FirstAppAppDelegate.m里添加:-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{//...ImageViewController*imgTab=[[ImageViewControlleralloc]init];UINavigationController*navImg=[[UINavigationControlleralloc]initWithRootViewController:imgTab. 阅读全文
posted @ 2012-05-04 15:50 Maxfong 阅读(779) 评论(0) 推荐(0)
摘要:如图所示,实现的功能:为了展示,我创建一个NavView文件,里面包含3个View:@interfaceNavView1:UIViewController{//代表View1}@end@interfaceNavView2:UIViewController{//代表View2}@end@interfaceNavView3:UIViewController{//代表View3}@end在NavViewController.m文件中,添加头文件:#import"NavView.h-(id)init{self=[superinit];if(self){[selfsetTitle:@" 阅读全文
posted @ 2012-05-03 23:31 Maxfong 阅读(465) 评论(0) 推荐(0)
摘要:在总结4的基础上创建一个Slider,添加代码如下:-(void)viewDidLoad{//....UISlider*slider=[[UISlideralloc]initWithFrame:CGRectMake(40.0,200.0,240.0,20.0)];slider.minimumValue=0;slider.maximumValue=100;slider.value=50;[slideraddTarget:selfaction:@selector(sliderValueChange:)forControlEvents:UIControlEventValueChanged];[[s. 阅读全文
posted @ 2012-05-03 23:29 Maxfong 阅读(391) 评论(0) 推荐(0)
摘要:需要交互,在TextFieldViewController.h中创建2个变量,并实现UITextFieldDelegate(Return):@interfaceTextFieldViewController:UIViewController<UITextFieldDelegate>{UILabel*resultLbl;UITextField*textField;}@property(retain,nonatomic)UILabel*resultLbl;@property(retain,nonatomic)UITextField*textField;在TextFieldViewCon 阅读全文
posted @ 2012-05-03 23:15 Maxfong 阅读(449) 评论(0) 推荐(0)
摘要:相同的,为了Tab init:-(id)init{self=[superinit];if(self){[selfsetTitle:@"按钮展示"];UIImage*img=[UIImageimageNamed:@""];[[selftabBarItem]setImage:img];}returnself;}在- (void)viewDidLoad中,创建2个按钮(Left and Right),设置Left的Tag为0,Right的Tag为1(区分谁点击),点击执行onClick事件:-(void)viewDidLoad{UIButton*leftBtn 阅读全文
posted @ 2012-05-03 23:10 Maxfong 阅读(348) 评论(0) 推荐(0)
摘要:首先在TableViewController.h中,将UIViewController改成UITableViewController(委托先不写),并创建一个数组:@interfaceTableViewController:UITableViewController{NSMutableArray*data;}在init方法中,我们初始化此表为分组表:-(id)init{self=[superinitWithStyle:UITableViewStyleGrouped];//分组样式if(self){[selfsetTitle:@"表格展示"];UIImage*img=[UII 阅读全文
posted @ 2012-05-03 22:56 Maxfong 阅读(200) 评论(0) 推荐(0)
摘要:在FirstAppAppDelegate.m的添加文件引用#import"ImageViewController.h"#import"TableViewController.h"#import"ButtonViewController.h"#import"TextFieldViewController.h"#import"NavViewController.h"在- (BOOL)application:(UIApplication *)application didFinishLaunching 阅读全文
posted @ 2012-05-03 22:18 Maxfong 阅读(346) 评论(0) 推荐(0)
摘要:作为第一个Tab,需要设置Title,在init内搞定:-(id)init{self=[superinit];if(self){[selfsetTitle:@"图片展示"];UIImage*img=[UIImageimageNamed:@""];[[selftabBarItem]setImage:img];}returnself;}此处未添加图片名称,所以TabBar只显示“图片展示”。在- (void)viewDidLoad 中添加view add image 代码:UIImageView*imageview=[[UIImageViewalloc]in 阅读全文
posted @ 2012-05-03 10:07 Maxfong 阅读(996) 评论(0) 推荐(0)
摘要:接触iphone开发也有半年了,看了点东西,最近总是记不住,写一个App,总结下,尽可能的添加功能。代码也会不断完善。希望好人指点指点。 暂时想到的内容包含在5个tabbar中,添加5个UIViewController,分别命名为:ImageViewController、TableViewController、ButtonViewController、TextFieldViewController、NavigationViewController,包含的内容为(持续添加):ImageView: 1.添加图片 7.添加相机按钮。 添加TextField,做SQL操作。 Core Dat... 阅读全文
posted @ 2012-05-03 09:29 Maxfong 阅读(344) 评论(0) 推荐(1)