首页 文章 精选 留言 我的

精选列表

搜索[金融专有云开发测试平台],共10000篇文章
优秀的个人博客,低调大师

iOS开发之城市选择器

城市选择器,借助于UIPickerView来实现,第一列为省份,第二列为第一列省份对应的城市或者区,数据放在plist中,plist结构如下图所示,第一层是一个Dictionary,每个省份对应的城市是一个Array: plist.png 实现步骤 第一步 拖入一个UIPickerView到StoryBoard中,然后设置UIPickerViewDelegate,和UIPickerViewDataSource为当前的控制器,如下图红色区域所示: 设置数据源与代理.png 第二步 在对应的ViewController中进行实现,代码注释非常详细 #import "ViewController.h" @interface ViewController () <UIPickerViewDelegate, UIPickerViewDataSource> /** * plist对应的字典 */ @property (nonatomic, strong) NSDictionary* cityNames; /** * 省份 */ @property (nonatomic, strong) NSArray* provinces; /** * 城市 */ @property (nonatomic, strong) NSArray* cities; /** * 选中的省份 */ @property (nonatomic, strong) NSString* selectedProvince; @end @implementation ViewController /** * 懒加载plist * * @return plist对应的字典 */ - (NSDictionary*)cityNames { if (_cityNames == nil) { NSString* path = [[NSBundle mainBundle] pathForResource:@"cityData" ofType:@"plist"]; _cityNames = [NSDictionary dictionaryWithContentsOfFile:path]; } return _cityNames; } /** * 懒加载省份 * * @return 省份对应的数组 */ - (NSArray*)provinces { if (_provinces == nil) { //将省份保存到数组中 但是字典保存的是无序的 所以读出来的省份也是无序的 _provinces = [self.cityNames allKeys]; } return _provinces; } - (void)viewDidLoad { [super viewDidLoad]; //设置默认选中的省份是provinces中的第一个元素 self.selectedProvince = self.provinces[0]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /** * 返回每一列的行数 * * @param pickerView * @param component * * @return */ - (NSInteger)pickerView:(UIPickerView*)pickerView numberOfRowsInComponent:(NSInteger)component { if (component == 0) { return self.provinces.count; } else { self.cities = [self.cityNames valueForKey:self.selectedProvince]; return self.cities.count; } } /** * 返回每一行显示的文本 * * @param pickerView * @param row * @param component * * @return */ - (NSString*)pickerView:(UIPickerView*)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { //第一列返回所有的省份 if (component == 0) { return self.provinces[row]; } else { self.cities = [self.cityNames valueForKey:self.selectedProvince]; return self.cities[row]; } } /** * 一共多少咧 * * @param pickerView * * @return */ - (NSInteger)numberOfComponentsInPickerView:(UIPickerView*)pickerView { return 2; } /** * 选中某一行后回调 联动的关键 * * @param pickerView * @param row 用户选择的省份 * @param component */ - (void)pickerView:(UIPickerView*)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { if (component == 0) { //选中的省份 self.selectedProvince = self.provinces[row]; //重新加载第二列的数据 [pickerView reloadComponent:1]; //让第二列归位 [pickerView selectRow:0 inComponent:1 animated:YES]; } } @end 实现效果 城市选择器.gif 附件 plist文件下载地址:http://pan.baidu.com/s/1dETRthZ

优秀的个人博客,低调大师

Python开发环境之pyenv环境搭建

首先到Github上下载Pyenv相应的一键安装脚本, $curl-Lhttps://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer|bash 安装完毕,设置环境变量,设置环境变量,可以添加到个人家目录的.bashrc或.bash_profile及系统的全 局的/etc/profile, #Loadpyenvautomaticallybyadding #thefollowingto~/.bash_profile: exportPATH="/home/lavenliu/.pyenv/bin:$PATH" eval"$(pyenvinit-)" eval"$(pyenvvirtualenv-init-)" 设置完毕之后,可以在命令行进行验证, [lavenliu@VM_113_230_centos~]$.~/.bash_profile [lavenliu@VM_113_230_centos~]$pyenv pyenv20160726 Usage:pyenv<command>[<args>] Someusefulpyenvcommandsare: commandsListallavailablepyenvcommands localSetorshowthelocalapplication-specificPythonversion globalSetorshowtheglobalPythonversion shellSetorshowtheshell-specificPythonversion installInstallaPythonversionusingpython-build uninstallUninstallaspecificPythonversion rehashRehashpyenvshims(runthisafterinstallingexecutables) versionShowthecurrentPythonversionanditsorigin versionsListallPythonversionsavailabletopyenv whichDisplaythefullpathtoanexecutable whenceListallPythonversionsthatcontainthegivenexecutable See`pyenvhelp<command>'forinformationonaspecificcommand. Forfulldocumentation,see:https://github.com/yyuu/pyenv#readme 以上都没有问题。比如,安装一个3.5.2的版本Python, pyenvinstall3.5.2 如果下载速度慢的话,可以事先下载之,放到~/.pyenv/cache目录即可。修改~/.pyenv/plugins/python-build/share/python-build/3.5.2文件, cat~/.pyenv/plugins/python-build/share/python-build/3.5.2 #require_gcc install_package"openssl-1.0.2g""https://www.openssl.org/source/openssl-1.0.2g.tar.gz#b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33"mac_openssl--ifhas_broken_mac_openssl install_package"readline-6.3""http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"standard--ifhas_broken_mac_readline ifhas_tar_xz_support;then install_package"Python-3.5.2""~/.pyenv/cache/Python-3.5.2.tar.gz"ldflags_dirsstandardverify_py35ensurepip else install_package"Python-3.5.2""~/.pyenv/cache/Python-3.5.2.tar.gz"ldflags_dirsstandardverify_py35ensurepip fi 由于没有~/.pyenv/cache目录,进行手工创建, $mkdir~/.pyenv/cache 如果使用手工安装,则需要安装一些依赖, #yuminstall-ygccmakepatchgdbm-developenssl-develsqlite-develzlib-develbzip2-develreadline-devel 需要事先准备好Python-3.5.2.tar.gz的安装包,放到~/.pyenv/cache目录下。然后,在命令行直接使用pyenv install 3.5.2即可, $pyenvinstall3.5.2 安装完毕,使用version命令进行查看, pyenvversion 3.5.2(setby/home/lavenliu/.python-version) 至此,已经安装完毕。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册