IOS development exploration
SunnyHughLee
https://github.com/zesicus
展开
-
OC中@property
学OC有一段时间了,很让人容易忽略的东西今天写代码看到Extension后面跟着的大括号里的属性并没有加@property关键字,故心存疑问@property的作用1、自动生成带下划线的变量2、自动生成getter和setter的声明和实现原创 2015-12-08 21:47:07 · 295 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (二)应用XMPP&代理&全局变量
底层始于XMPP首先构筑底层,底层为上层服务,也就是我们对XMPP框架提供接口编程的应用。我是在AppDelegate中写的,可是为什么要在AppDelegate中写? Nice question! Cuz the demo which the author gave was written in AppDelegate. 好吧,开个玩笑,不过按照我的理解,创建在AppDelegate中原因只是原创 2015-12-23 13:50:17 · 921 阅读 · 1 评论 -
Habber - IOS XMPP 客户端 教程 (一)准备工作
一些准备Swifty这是JamalK做的一款swift语言的登录页,程序是用OC写的,通过实践说明swift和OC兼容的很好~https://github.com/JamalK/Swifty TSPopoverView像iPad那样弹出的popover气泡式菜单。由于iPhone默认弹出popover是页面替换而不是气泡式https://github.com/takashisite/TSPop原创 2015-12-23 10:58:25 · 1018 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (三)VC始于LoginViewController、、
VC始于登录页面之所以用了这个标题因为app结构不大又把view和controller写在了一起。。。。。不过我已经用 //MARK: 标注了应该会清晰一些。好吧,先不管其它,的确是从swift版的登录页面开始。 这里已经认为你做好了storyboard上带server文本框的界面,上代码!LoginViewController.swift//// LoginViewController.sw原创 2015-12-23 14:22:36 · 983 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (四)聊天界面制作
Hello world!终于到了聊天界面了,虽然是自己做的,但是写博客把制作过程重新回顾一下也是比较累脑……OK,进入正题!由于用的是UUChatTableView,改了些东西,xib和storyboard差不多但是还是不一样,从auto layout的计算上就不同、因为UUChat上添加了群聊功能,我的app并没有这个功能,所以,删!治标先治本,让我们来看一下ChatModel ChatMode原创 2015-12-23 15:26:56 · 1606 阅读 · 1 评论 -
Habber - IOS XMPP 客户端 教程 (终)总结与反思
折腾是一个过程,它从未间断坑了我一晚上的框架视图,因为第三方的TSPopover没有在视图上正确弹出,而且console上提示“whose view is not in the window hierarchy”,遂查之,stackoverflow上的解决方案也没有用,怀疑过swift和OC并不能良好的匹配,怀疑过swift写的那个视图有问题, 直到早上终于把问题确定在框架上,只见框架是这么加载原创 2015-12-23 15:52:38 · 732 阅读 · 0 评论 -
OC一些概念上的理解
1、OC中类可以实现多继承吗?可以实现多接口吗?Key:OC不可以实现多继承,但可以实现多接口。2、Category是什么,它的作用是什么?和继承的区别?和Extension的区别?Key:Category是分类,一般在不获悉,不改变原代码的情况下添加新方法,只能添加不能修改删除,并且不能够添加属性,如果扩展的方法和原方法重名,则会替代原方法,不像继承可以通过super调用。此外继承可以添加修改删除原创 2015-12-03 14:52:55 · 748 阅读 · 0 评论 -
Present modally 返回主界面
- (IBAction)back:(UIBarButtonItem *)sender { [self dismissViewControllerAnimated:YES completion:nil];}原创 2015-12-07 09:46:31 · 529 阅读 · 0 评论 -
IOS开发之启动画面延时
原理:将主线程设置睡眠延时//启动画面延时1秒[NSThread sleepForTimeInterval:1.0];原创 2015-12-07 09:35:15 · 391 阅读 · 0 评论 -
Xcode7.1 'libxmlSimu' 找不到
这篇的重点不是解决这个问题,重点是通过这个问题学到了一个新工具的使用——CocoaPods方案一:一个多月前github上就有人post了这个issue,然后各种解决方案提出。 libxmlSimu not when found manually added the frameworks 其中一条解决方案就是:回滚到上个版本 所以让我们加在pod file 里的东西到底是干什么用的? bi原创 2015-12-14 17:37:26 · 563 阅读 · 0 评论 -
IOS关闭虚拟键盘
添加代理 <UITextFieldDelegate>实现代理 viewDidLoad中加入field.delegate = self;实现点return键盘关闭#pragma mark - Implements UITextFieldDelegate- (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textFiel原创 2015-12-07 11:04:49 · 399 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (三)着手制作好友列表
在此之前在此之前我们需要做一下它:这是TSPopover对象里面嵌入了一个表格,让我们来做一下这个黑色表格: PopTableViewController.h#import <UIKit/UIKit.h>@interface PopTableViewController : UITableViewController@property (nonatomic, strong) NSString原创 2015-12-23 14:53:42 · 1118 阅读 · 0 评论 -
IOS后台常驻,实现后台下载
上班快一个月了,好久没有更新过博客,正好公司做的项目让解决后台下载的问题,在网上有查到一般都是通过后台播放无声或者VOIPSocket防止程序终结,但是没有相关功能会有被App Store拒绝上架的可能,我仅仅想完成一个后台下载。原创 2016-01-26 15:24:57 · 4385 阅读 · 0 评论 -
调用暗色键盘
可以在viewDidLoad中添加Field.keyboardAppearance = UIKeyboardAppearanceDark;原创 2015-12-07 09:53:07 · 466 阅读 · 0 评论 -
IOS VLC 播放器 开发 滑动快进和后退
刚做好一个基于MobileVLCKit的播放器,其中关于滑动屏幕快进和后退的功能困扰已久,在github下载各种播放器来借鉴,终有所得,故而分享之。见代码:#pragma mark - touch- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { [super touchesBegan:t原创 2016-01-02 17:20:34 · 4531 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (零)简介与源码下载
12.27更新增加对方输入的状态显示此次更新对方输入状态显示在Navigation Bar title位置,显示为 “Is typing...”,同样代码改动的地方较多,故不在博客中更新,所有集成更新源码均放在Github上,在“源码下载”区提供地址。后面开一篇帖子描述怎样添加对方输入状态。12.25更新修复一些bugs更改了界面的配色增加注册好友的功能But I have to say原创 2015-12-22 23:54:46 · 1085 阅读 · 0 评论 -
Habber - IOS XMPP 客户端 教程 (续)对方输入状态显示
Train of thought要显示对方输入状态,也就是说要给对方发送一个标志,对方接收到这个标志,就知道你正在输入,然后在标题栏上显示你正在输入就行了。那怎么发送标志呢?知道了我们传输的信息都是XML文件,也就是要接收两个不同的状态。增加一个标记composing,假如我们输入的时候它就传递isTyping,不输入的时候什么都不传就好了。Do it!OK, 有了思路我们就着手去做。首先我得知道原创 2015-12-27 16:02:28 · 1371 阅读 · 0 评论 -
IOS等比率缩放图片 工具function
IOS UIImage 缩放原创 2016-03-08 15:52:53 · 447 阅读 · 0 评论 -
糯米团—重制“iPhone团购信息客户端”(零)源代码与跳的那些坑和思考
前言 早就盼望着这一天发布博客记录我写程序的路程! 是的,是第一个写在csdn上的app制作笔记!终于完成这个程序!! 虽然有bug且功能单一,作为一个练手的app做出还是很有成就感,故拿出来和同样的新手朋友们一起分享~ 感谢kangkangz4博主写的的客户端模型,我才有了样例去remade,去学习怎样做一个好玩的团购客户端 :) 历时6天,终于基本做出了我想要的原创 2015-12-13 18:45:19 · 855 阅读 · 0 评论 -
IOS 导航条 以及 状态栏颜色 相关设置
局部导航栏颜色设置//设置导航条颜色 美团导航栏颜色 self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:78.0/255 green:238.0/255 blue:218.0/255 alpha:1.0];//设置导航条文字颜色 白色 self.navigationController.原创 2015-12-07 10:20:49 · 4011 阅读 · 0 评论 -
两个ViewControllerScene互相show,全局变量失效?简直就是zuo!
我从来就没见过!本来想做一个按钮更改中英文的,localise storyboard后产生两个SB,想了一下直接把其中一个storyboard删了,把view controller scene直接拿出来粘到原来的SB了,这样一个Main.storyboard就有了两个view controller scene。自作聪明互相show了……全局变量失效!互相show是没有问题的,因为都是同样的控件,索原创 2015-12-05 02:22:49 · 797 阅读 · 0 评论 -
糯米团—重制“iPhone团购信息客户端”(二)
好,接着上一篇来,BusinessLogicLayer完了之后是PresentationLayer首先从MainCell文件夹里开始 这里面存放的是GridView的单元格的定义,最终呈现出 的样式。GridViewCell.h#import "AQGridViewCell.h"@interface GridViewCell : AQGridViewCell@property (nonato原创 2015-12-13 23:12:55 · 650 阅读 · 0 评论 -
糯米团—重制“iPhone团购信息客户端”(三)
一个cell和一个popover写好之后,就可以进入主视图的编辑了。FirstViewController.h#import <UIKit/UIKit.h>#import "AQGridView.h"#import "GridViewCell.h"#import "ASIHTTPRequest.h"#import "XMLParser.h"#import "MBProgressHUD.h"原创 2015-12-13 23:22:12 · 944 阅读 · 0 评论 -
糯米团—重制“iPhone团购信息客户端”(四)
奥对,忘了说了,Xcode7已经默认https连接了,自动锁定了http连接 Solution: 1. 在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary. 2. 在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean,value为YES接下来写显示商品详情的类 sto原创 2015-12-13 23:38:55 · 539 阅读 · 0 评论 -
理解Bitcode:一种中间代码
来源:南峰子的技术博客今天试着用Xcode 7 beta 3在真机(iOS 8.3)上运行一下我们的工程,结果发现工程编译不过。看了下问题,报的是以下错误:ld: ‘/Users/**/Framework/SDKs/PolymerPay/Library/mobStat/lib**SDK.a(**ForSDK.o)’ does not contain bitcode. You must rebuil转载 2015-12-14 19:10:19 · 379 阅读 · 0 评论 -
Xcode7 nib文件在哪,xib为什么被替换掉了?
作为一个自学IOS开发快一年的人来说,现在才来看回顾这个问题,虽然已经有疑问很久了,直到用了别人一个界面框架,此问题重新被引出并认真对待!nib -> xib -> storyboard ? Interface builder当我接触IOS开发时刚开始用的就是Xcode6,原来的启动过渡界面用的应该是LaunchScreen.xib,到了7现在已经改成了同样的storyboard。nib据当时原创 2015-12-14 23:59:07 · 2072 阅读 · 0 评论 -
糯米团—重制“iPhone团购信息客户端”(一)
前言 因为是重制的客户端,作者博客中写到的很详细的内容相同的这里不会再写,但会给出提示,对照查看。 iPhone团购信息客户端的开发目录结构 由于原作没有按照分层架构设计,所以这里我按照自己想法进行分层架构设计的,不过本来我也是全写在一个文件中的,但是文件过于冗长层次也不清晰所以拆分了两个模块下来,真的是很难拆,要改动很多,所以只拆了两个下来放到BusinessLayer中了。准备原创 2015-12-13 22:48:10 · 536 阅读 · 0 评论 -
Swift学习笔记|Swift面向对象
1、构造函数重载import Foundationclass Hello{ var _name:String="Swift" init(name:String){ _name=name } init(){ //构造函数重载 } func sayHi(){ println("Hello, \(_name).")原创 2014-11-09 14:38:34 · 399 阅读 · 0 评论 -
Swift学习笔记|swift基本语法
1、输出语句:println("Hello, world! ")2、定义变量:var i = 3 i =10 定义常量:let c = 10 字符串变量:var str = "Hello "var s:String = "World." //类型说明,省略则由编译器自行判断。println(str) 可选变量//字符转换成整数,但是类原创 2014-11-08 16:57:04 · 451 阅读 · 0 评论 -
Xcode升级最新版找不到*.dylib的解决办法
点击 Build Phases > Link Binary with Librairies > + > Add other在这个窗口上按下 "CMD"+Shift+G" 路径处输入 /usr/lib/从这个路径下面选择你想要的*.dylib文件添加就好。Compile and have fun原创 2015-11-28 14:54:26 · 634 阅读 · 0 评论 -
UIBarButton 图片显示不正常解决方案
在storyboard上set image会显示成蓝色的形状,查过资料说应该设置图片的alpha值,还TND设置个鬼的alpha,从stackOverFlow找到了解决方法,很简单,具体思路是: 1. 构建一个带背景的UIButton 2. 把构建的UIButton用UIBarButton初始化具体代码://设置UIButtonUIImage *menuImage = [UIImage ima原创 2015-12-15 19:06:55 · 1275 阅读 · 0 评论 -
OC_ self , 属性特性readwrite readonly assign retain copy nonatomic
Source: http://www.2cto.com/kf/201412/361299.html1,实例方法里面的self,是对象的首地址。2,类方法里面的self,是Class.尽管在同一个类里面的使用self,但是self却有着不同的解读。在类方法里面的self,可以翻译成class self;在实例方法里面的self,应该被翻译成为object self。在类方法里转载 2015-08-12 14:52:41 · 416 阅读 · 0 评论 -
IOS 8 固定方向
//支持全部方向旋转- (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll;}其它旋转方向的允许与禁止按command点击UIInterfaceOrientationMask 查看。原创 2015-12-15 14:31:01 · 330 阅读 · 0 评论 -
Object-C 分类(Category) 和 扩展(Extension)
分类(Category)分类作为一种编译的手段,允许通过类添加方法来扩展原有类。但只能是方法,不能够添加实例变量的扩展。常用文件名 类名+分类名.h(.m) Pay attention here, 分类名不用和方法名一样,标示符而已。举例说明,扩展NSNumber的类://NSNumber+Message.h#import <Foundation/Foundation.h>@interface原创 2015-12-01 11:29:26 · 700 阅读 · 0 评论 -
OC为什么需要copy
作为一个菜鸟写了几个app后突然发现自己对此产生疑问。 因为很少用到copy,仅仅也就知道深复制、浅复制的一些概念而已,那什么时候使用呢?+ (NSArray *)retrieveInventoryItems { NSMutableArray *inventory = [NSMutableArray array]; NSError *err; NSArray *jsonIn原创 2016-01-03 16:09:52 · 475 阅读 · 0 评论 -
Xcode7 建立 pch 文件 (预编译头文件)
Query: pch 文件 干嘛的? 百度百科:pre-Compile Header(预编译头文件),由编译器在建立工程时自动生成; 其中存放有工程中已经编译的部分代码; 在以后建立工程时不再重新编译这些代码。经过实践后我的认知:pch文件经过加载后里面的内容会预先执行。 Example:pch文件里面引用了<UIKit/UIKit.h>头文件后,我新建立的类如果需要引入UIKit的头文原创 2015-12-02 21:55:25 · 1404 阅读 · 0 评论 -
IOS关闭虚拟键盘的几种方法
转载自Linux公社:http://www.linuxidc.com/Linux/2013-02/78867.htm第一种方法使用它的委托UITextFieldDelegate中的方法textFieldShouldReturn:来关闭虚拟键盘。在UITextField视图对象如birdNameInput所在的类中实现这个方法。- (BOOL)textFieldShouldReturn:(UITex转载 2015-12-04 23:48:26 · 1180 阅读 · 0 评论 -
UITableView 单元格自定义个别不能滑动删除
//自定义滑动单元格显示按钮名称- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { return @"删除";}//这里设置能够滑动和不允许滑动的单元格- (void)tableView:原创 2016-03-08 20:17:15 · 445 阅读 · 0 评论