用ios做的一个简单的记事本
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *标题; //用的是一个text按键
@property (weak, nonatomic) IBOutlet UITextView *文本; //用的是一个text view按键
@end
@implementation ViewController
- (IBAction)创建:(id)sender { //创建的是一个button按键 点击就可以进行书写了
self.标题.text=@""; //使得开始输入的时候 标题的文本text中清空
self.文本.text=@""; //使得开始输入的时候 文本框text view清空
}
- (IBAction)保存:(id)sender { //创建的一个button按键 用以保存已经写的文本
NSString *name=self.标题.text; //将标题中的输入文本赋值给name这样的一个指针
NSString *content=self.文本.text; //将文本中的输入内容赋值给content这样的一个指针
NSString *path=[NSString stringWithFormat:@"/Users/apple/Desktop/%@",name]; //将你要保存的“地址”给一个path的指针变量
[content writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];//将content中的文本内容保存在path我那本中.如果不存在则自行建立
}
- (IBAction)读取:(id)sender {
NSString *name=self.标题.text; //将标题中的输入文本赋值给name这样的一个指针
NSString *path=[NSString stringWithFormat:@"/Users/apple/Desktop/%@",name];//将你要保存的“地址”给一个path的指针变量
NSString *content=[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];//把地址中的文件取出来给content
self.文本.text=content;//将content中的文本显示在text view的文本框中
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)标题:(id)sender {
}
@end
用ios做的一个简单的记事本的更多相关文章
- C++-Qt【2】-实现一个简单的记事本
用Qt实现一个简单的记事本: #include "helloqt.h" #include <qfiledialog.h> #include <qfile.h> ...
- 如何用PHP/MySQL为 iOS App 写一个简单的web服务器(译) PART1
原文:http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app 作为一个i ...
- 在iOS中实现一个简单的画板App
在这个随笔中,我们要为iPhone实现一个简单的画板App. 首先需要指出的是,这个demo中使用QuarzCore进行绘画,而不是OpenGL.这两个都可以实现类似的功能,区别是OpenGL更快,但 ...
- ios(iphone/ipad)一个简单的用代码判断当前设备的方法
直接NSLog(@"current_device:%@",[UIDevice currentDevice].model); 即可看出它输出的是当前设备,所以根据这个字符串可简单的判 ...
- JS 的execCommand 方法 做的一个简单富文本
execCommand 当一个 HTML 文档切换到设计模式(designMode)时,文档对象暴露 execCommand 方法,该方法允许运行命令来操纵可编辑区域的内容.大多数命令影响文档的选择( ...
- 在iOS上实现一个简单的日历控件
http://blog.csdn.net/jasonblog/article/details/21977481 近期需要写一个交互有点DT的日历控件,具体交互细节这里略过不表. 不过再怎么复杂的控件, ...
- 用if做了一个简单的猜拳游戏(做的不好还请指点,谢谢!)
#include "stdio.h" #include "stdlib.h" #include "time.h" //随机函数的头文件 ma ...
- 用编写一个简单的记事本(C#实现)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 【转载】用C#编写一个简单的记事本
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
随机推荐
- LEK-Introduction
LEK - logstash + elasticsearch + Kibana Elasticsearch, Logstash, and Kibana — designed to take data ...
- Oracle SQL Developer 设置自动提示(完成设置)
- caffe编译出现的新错误
1.include/caffe/blob.hpp:9:34: fatal error: caffe/proto/caffe.pb.h: No such file or directory #inclu ...
- mongodb集群+分片部署(二)
机器:10.165.38.68 10.165.38.72 部署包:mongodb-linux-x86_64-rhel55-3.0.2.tgz(百度云盘下载地址:http://pan.baidu. ...
- Save Update saveOrUpdate delete
参考:Hibernate Session的saveOrUpdate()方法 saveOrUpdate与Update的作用 Hibernate Delete query Hibernate Basics ...
- JS复习:第十、十一章
第十章 NodeList是一种类数组对象,用于保存一组有序的节点,可以通过位置来访问这些节点,但它并不是Array实例,将其转化为数组的方法: function converToArray(nodes ...
- 浙江大学Pat 1036 题解
1036. Boys vs Girls (25) This time you are asked to tell the difference between the lowest grade of ...
- HDU 1069 I Think I Need a Houseboat(模拟)
题目链接 Problem Description Fred Mapper is considering purchasing some land in Louisiana to build his h ...
- Openjudge-计算概论(A)-统计字符数
描述: 判断一个由a-z这26个字符组成的字符串中哪个字符出现的次数最多输入第1行是测试数据的组数n,每组测试数据占1行,是一个由a-z这26个字符组成的字符串每组测试数据之间有一个空行,每行数据不超 ...
- 关于ios 程序加载百度地图lib,出现链接错误:找不到符号 (null): _OBJC_CLASS_$_BMKMapManager的解决办法
报告的错误信息 ld: warning: ignoring file /Users/5012/Documents/sphuang/IOS_project/baidu_map/ShareLocation ...