#import "ViewController.h"
@interface Viewcontroller ()
@property (Weak, nonatomic) iboutlet Uitextfield * title; With a text button.
@property (Weak, nonatomic) iboutlet Uitextview * text; A text View button is used
@end
@implementation Viewcontroller
-(Ibaction) Create: (ID) Sender {//Create a button button click to write
Self. Title [email protected] ""; The text of the caption is emptied when you start typing
Self. Text [email protected] ""; The text box is empty when you start typing
}
-(Ibaction) Save: (ID) Sender {//Create a button button to save the written text
NSString *name=self. title. Text; Assigns the input text in the caption to a pointer such as name
NSString *content=self. Text. Assigns the input in the text to a pointer such as content
NSString *path=[nsstring stringwithformat:@ "/users/apple/desktop/%@", name]; Give the "address" you want to save to a pointer variable of path
[Content Writetofile:path Atomically:yes encoding:nsutf8stringencoding error:nil];// Save the text content in the contents of the path in my book. If it doesn't exist, build it yourself.
}
-(Ibaction) read: (ID) Sender {
NSString *name=self. title. Text; Assigns the input text in the caption to a pointer such as name
NSString *path=[nsstring stringwithformat:@ "/users/apple/desktop/%@", name];//the "address" you want to save to a pointer variable of path
NSString *content=[nsstring Stringwithcontentsoffile:path encoding:nsutf8stringencoding error:nil];// Remove the file from the address to the content
Self. Text. text=content;//the text in the content is displayed in the text box of the text view
}
-(void) Viewdidload {
[Super Viewdidload];
Additional setup after loading the view, typically from a nib.
}
-(void) didreceivememorywarning {
[Super didreceivememorywarning];
Dispose of any resources the can be recreated.
}
-(Ibaction) title: (ID) Sender {
}
@end
A simple Notepad made with iOS