给他人不同人
来源:互联网 发布:linux mount 本地目录 编辑:程序博客网 时间:2024/04/25 22:10
#import <Foundation/Foundation.h>
@interface Student : NSObject
@property (nonatomic,strong)NSString *stuName,*stuNumber,*stuTheory,*stuComputer,*stuRemarks;
@property (nonatomic,assign)NSInteger stuID;
@end
#import "AppDelegate.h"
#import "MyTableViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
MyTableViewController *vc = [[MyTableViewControlleralloc]initWithStyle:UITableViewStyleGrouped];
UINavigationController *nav = [[UINavigationControlleralloc]initWithRootViewController:vc];
self.window.rootViewController = nav;
returnYES;
}
#import "MyTableViewController.h"
#import "AddViewController.h"
#import "LoadData.h"
@interface MyTableViewController ()
{
NSMutableArray *arr;
}
@end
@implementation MyTableViewController
- (void)viewDidLoad {
[superviewDidLoad];
[[LoadDatashareLoadData]createTable];
self.title =@"***";
self.navigationItem.leftBarButtonItem = [[UIBarButtonItemalloc]initWithTitle:@"***"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(addClicked)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"查***"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(showAllData)];
}
-(void)viewDidAppear:(BOOL)animated{
arr =[[LoadDatashareLoadData]showAllData];
[self.tableViewreloadData];
}
-(void)addClicked{
AddViewController *vc = [[AddViewControlleralloc]init];
vc.idl =0;
[self.navigationControllerpushViewController:vcanimated:YES];
}
#if 0
-(void)showAllData{
//查询第一个数据
arr = [[LoadData shareLoadData] showTop1Data];
[self.tableView reloadData];
}
#elif 1
-(void)showAllData{
//查询理论成绩最高的学生
arr = [[LoadDatashareLoadData]showTheoryMaxData];
[self.tableViewreloadData];
}
#elif 0
-(void)showAllData{
//查询机试成绩最高的学生
arr = [[LoadData shareLoadData] showComputerMaxData];
[self.tableView reloadData];
}
#elif 0
-(void)showAllData{
//删除理论成绩最低分的纪录
arr = [[LoadData shareLoadData] deleteTheoryMinData];
[self.tableView reloadData];
}
#endif
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
returnarr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
staticNSString *str =@"cell";
UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:str];
if (!cell) {
cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleValue1reuseIdentifier:str];
}
cell.textLabel.text = [arr[indexPath.row]stuName];
cell.detailTextLabel.text = [arr[indexPath.row]stuNumber];
return cell;
}
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
returnYES;
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle ==UITableViewCellEditingStyleDelete) {
[[LoadDatashareLoadData]deleteData:[arr[indexPath.row]stuID]];
[arrremoveObjectAtIndex:indexPath.row];
[self.tableViewreloadData];
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
AddViewController *vc = [[AddViewControlleralloc]init];
vc.idl =1;
vc.st =arr[indexPath.row];
[self.navigationControllerpushViewController:vcanimated:YES];
}
#import <UIKit/UIKit.h>
#import "Student.h"
#import "LoadData.h"
@interface AddViewController : UIViewController
@property (nonatomic,assign)NSInteger idl;
@property (nonatomic,strong)Student *st;
@end
@interface AddViewController ()
@property (weak,nonatomic)IBOutletUITextField *stuNameText;
@property (weak,nonatomic)IBOutletUITextField *stuNumberText;
@property (weak,nonatomic)IBOutletUITextField *stuTheoryText;
@property (weak,nonatomic)IBOutletUITextField *stuComputerText;
@property (weak,nonatomic)IBOutletUITextField *stuRemarksText;
@property (weak,nonatomic)IBOutletUIButton *addButton;
@end
@implementation AddViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view from its nib.
if (self.idl ==0) {
[_addButtonsetTitle:@"添加"forState:UIControlStateNormal];
}else{
self.stuNameText.text =self.st.stuName;
self.stuNumberText.text = self.st.stuNumber;
self.stuTheoryText.text = self.st.stuTheory;
self.stuComputerText.text = self.st.stuComputer;
self.stuRemarksText.text = self.st.stuRemarks;
[_addButtonsetTitle:@"修改"forState:UIControlStateNormal];
}
}
- (IBAction)AddData:(id)sender {
if (self.idl ==0) {
Student *stu = [[Studentalloc]init];
stu.stuName =self.stuNameText.text;
stu.stuNumber =self.stuNumberText.text;
stu.stuTheory =self.stuTheoryText.text;
stu.stuComputer =self.stuComputerText.text;
stu.stuRemarks =self.stuRemarksText.text;
[[LoadDatashareLoadData]addData:stu];
[self.navigationControllerpopViewControllerAnimated:YES];
}
else{
Student *stu = [[Studentalloc]init];
stu.stuID =self.st.stuID;
stu.stuName =self.stuNameText.text;
stu.stuNumber =self.stuNumberText.text;
stu.stuTheory =self.stuTheoryText.text;
stu.stuComputer =self.stuComputerText.text;
stu.stuRemarks =self.stuRemarksText.text;
[[LoadDatashareLoadData]updateData:stu];
[self.navigationControllerpopViewControllerAnimated:YES];
}
}
- 给他人不同人
- 给他人多不突然地给不同的人骨痛热
- 给企业微信成员不同人发不同的文件
- 不同人眼中的我
- 不同人眼里的华为
- 给他人同意
- 不同人的信息,虚函数
- 趣图:不同人眼中的程序员
- 个突然地不同人的不同人的改好
- 不损害他人就行
- 超衫!不同人写的HelloWorld程序
- 敏捷实践(四)---- 不同人的观点
- 不同人眼中的IT男,谁躺枪了
- 如何实现同一份报表,不同人看不同数据
- 重新出现他人刚发退还给
- 发热热给他人沟通人
- 为他人着想,给自己光明
- 同人 天火同人 乾上离下
- 请你出列
- 今天我思维特别缜密,结果发现:
- poj 1122
- 东方红
- RasGetConnectStatus
- 给他人不同人
- 液氨泄漏
- 拔牙记
- jQuery属性操作之toggleClass()和hasClass()方法的比较
- 成功女士
- 什么是国耻
- win8系统安装时2503,2502错误解决办法
- 使用poi将数据导出到excel
- CS