UICatalog 随手记

本文介绍了解决iOS开发中文件权限问题的方法,并详细讲解了如何使用MainViewControl进行UITableView的数据管理和界面操作,同时涵盖了UIButton和UITextField的基本用法及定制选项。

解决问题:

xCode problem: You don't have permission to save the file "iOS DeviceSupport" in the folder 'XCode'

 

sudo chmod 777 /Users/<Acount>/Library/Developer/Xcode

 

1:MainViewControl

他是继承 UITableViewController所以他自动带了tableview和很多table相关的代理

他使用了NSMutableArray + NSDictionary

viewDidLoad里面初始化所有的数据(建议一个NSMutableArray

viewWillAppear保证没有选中标志

        NSIndexPath *tableSelection = [self.tableViewindexPathForSelectedRow];     //  去掉以前选中的标志

[self.tableViewdeselectRowAtIndexPath:tableSelectionanimated:NO];


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section //设立section里面行数

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView  //设立section数

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section //设立section标题



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath //设立行内容

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath // 设定点击的反应


        UIViewController *targetViewController = [[self.menuListobjectAtIndex: indexPath.row]objectForKey:kViewControllerKey];

[[selfnavigationController]pushViewController:targetViewControlleranimated:YES]; // 切换viewcontrol


self.title = 。。。 // 设置自己view control的标题






2: Button


  1. typedef enum {  
  2.     UIButtonTypeCustom = 0,           // no button type   自定义,无风格  
  3.     UIButtonTypeRoundedRect,          // rounded rect, flat white button, like in address card 白色圆角矩形,类似偏好设置表格单元或者地址簿卡片  
  4.     UIButtonTypeDetailDisclosure,//蓝色的披露按钮,可放在任何文字旁  
  5.     UIButtonTypeInfoLight,//微件(widget)使用的小圆圈信息按钮,可以放在任何文字旁  
  6.     UIButtonTypeInfoDark,//白色背景下使用的深色圆圈信息按钮  
  7.     UIButtonTypeContactAdd,//蓝色加号(+)按钮,可以放在任何文字旁  
  8. } UIButtonType;  

建立button两种方式:

1:通过alloc+initwithframe来建立

UIButton *button = [[UIButtonalloc]initWithFrame:frame];


2:通过buttonWithType来建立

UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] retain];

roundedButtonType = [[UIButtonbuttonWithType:UIButtonTypeRoundedRect]retain];



3: UITextField


typedefenum {

    UITextBorderStyleNone,

    UITextBorderStyleLine,

    UITextBorderStyleBezel,       // 普通边框

    UITextBorderStyleRoundedRect  // 圆角

} UITextBorderStyle;



通过alloc+initwithframe来建立

             textFieldRounded.returnKeyType =UIReturnKeyDone;

     textFieldRounded.clearButtonMode = UITextFieldViewModeWhileEditing;// has a clear 'x' button to the right

    为了在按done 以后 消掉键盘:

    设置一个textFieldRounded.delegate 

    并且:

          

- (BOOL)textFieldShouldReturn:(UITextField *)textField

{

// the user pressed the "Done" button, so dismiss the keyboard

[textFieldresignFirstResponder];

returnYES;

}

     













内容概要:本文介绍了一种基于双层优化的微电网系统规划设计方法,旨在通过Matlab代码实现,解决微电网在规划与运行中的多目标、多层次决策问题。该方法将优化过程分为上下两层:上层通常负责容量配置、设备选址等长期规划决策,下层则聚焦于能量管理、出力调度等短期运行优化,通过迭代交互实现全局最优。文中详细阐述了模型构建、约束条件设定、目标函数设计及求解算法实现流程,并提供了完整的Matlab代码供复现实验,有助于深入理解微电网系统的设计逻辑与优化机制。; 适合人群:具备一定电力系统基础知识和Matlab编程能力,从事新能源、微电网、综合能源系统等领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:① 学习和掌握双层优化理论在微电网规划设计中的具体应用;② 通过阅读和运行Matlab代码,复现并改进经典优化模型,用于学位论文、科研项目或实际工程方案设计;③ 深入理解微电网中分布式能源、储能与负荷的协同优化调度策略。; 阅读建议:此资源以Matlab代码实现为核心,强调理论与实践的结合。建议读者先理解双层优化的基本思想和数学模型,再结合代码逐行分析,重点关注变量定义、约束条件的代码转化以及主从问题间的迭代逻辑。鼓励在提供的代码基础上进行参数调整、场景扩展或算法改进,以深化学习效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值