用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 ...
随机推荐
- 架设自己的FTP服务器 Serv-U详细配置图文教程
转自:http://www.jb51.net/article/31635.htm 所有不是很要求安全的情况下是可以用serv_U的,当然我们也可以通过一些设置,保证serv_u安全运行.这里就分享下s ...
- 【.NET】发送Email
首先,在web.config的appSettings配置一下. <appSettings> <add key="FromMail" value="xxx ...
- linux的命令使用记录
iptables禁止53端口的出包(dns) iptables -A OUTPUT -p udp --dport 53 -j DROP linux查看网络监听端口 netstat -npl 文件复制 ...
- php系统无法上传图片问题
PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0 我的测试环境是 w ...
- ACdream 1063 平衡树
写的很丑的字典树.听王大神的话 需要改进. #include<stdio.h> #include<string.h> #include<math.h> #incl ...
- zoj 1586 QS Network
最小生成树,刚刚学了Prim算法. 对每条边变的权值进行预处理,c[i][j] = c[i][j] + p[i] + p[j] 其中c[i][j]为输入的权值,p[i],p[j]为连接这两个节点所需的 ...
- Linux常用使用技巧
一.如何实时查看linux下的日志 cat /var/log/*.log 如果日志在更新,如何实时查看 tail -f /var/log/messages 还可以使用 watch -d -n 1 ca ...
- Chapter 2 Open Book——31
"It's too bad about the snow, isn't it?" Edward asked. I had the feeling that he was forci ...
- background-clip、background-origin、box-sizing
background-clip:border-box(默认).padding-box.content-box background-origin:border-box.padding-box(默认). ...
- Hadoop安装教程
单机.伪分布式:http://dblab.xmu.edu.cn/blog/install-hadoop/ 集群:http://dblab.xmu.edu.cn/blog/install-hadoop- ...