- 博客(25)
- 资源 (8)
- 收藏
- 关注
转载 KVC 与 KVO 理解
KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解。Key-Value Coding (KVC)KVC,即是指 NSKeyValueCoding,一个非正式的 Protocol,提供一种机制来间接访问对象的属性。KVO 就是基于 KVC 实现的关键技术之一。一个对象拥有某些属性。比如说,一个 Person 对象有一个 na
2015-03-03 10:32:33
526
原创 UICollectionViewController使用,pushViewController弹出时
UICollectionViewController不同于其他viewcontroller,在使用过程中特别容易出现这种错误UICollectionView must be initialized with a non-nil layout parameter如果是这样(已经建立了一个UICollectionViewController的storyboard),这是
2015-02-12 11:27:39
1130
转载 iOS 屏幕适配,autoResizing autoLayout和sizeClass图文详解
1. autoResizingautoresizing是苹果早期的ui布局适配的解决办法,iOS6之前完全可以胜任了,因为苹果手机只有3.5寸的屏幕,在加上手机app很少支持横屏,所以iOS开发者基本不用怎么适配布局,所有的ui控件只要相对父控件布局就可以了,没错autoResizing就是一个相对于父控件的布局解决方法;注意:它只能相对父控件布局;***在xcode中可以通过可视
2015-01-18 15:57:29
995
转载 iphone和ipad关于removeFromSuperview使用注意
[UIApplication sharedApplication].keyWindow.subviews正常情况下当前窗口的subview只有一个,但是有时需要将整个屏幕蒙上一层半透明的view并显示自定义的提示框,这时会在当前窗口里参加view使得subview不止一个。本来如果用removeFromSuperview方法就可以把新增的view去掉,但是如果你不小心把原始的vie
2014-10-16 10:50:46
949
转载 ObjC利用正则表达式抓取网页内容(网络爬虫)
在开发项目的过程,很多情况下我们需要利用互联网上的一些数据,在这种情况下,我们可能要写一个爬虫来爬我们所需要的数据。一般情况下都是利用正则表达式来匹配Html,获取我们所需要的数据。一般情况下分以下三步。1、获取网页的html2、利用正则表达式,获取我们所需要的数据3、分析,使用获取到的数据,(例如,保存到数据库)接下来我们分析代码:
2014-08-21 14:33:10
514
转载 Reusing UITableViewCells
iOS devices have a limited amount of memory. If you were displaying a list with thousands of entriesin a UITableView, you would have thousands of instances of UITableViewCell. And your longsuffering
2014-07-26 17:15:37
853
原创 ios view的几种加载函数的区别didFinishLaunchingWithOptions、initWithNibName:bundle、loadView、viewWillAppear
application:didFinishLaunchingWithOptions: is where you instantiate and set anapplication’s root view controller.This method gets called exactly once when the application has launched. Even if you
2014-07-17 16:17:08
731
转载 An iOS 7 UIPickerView Example
Creating the iOS 7 PickerView ProjectThe example application in this chapter is a rudimentary currency conversion tool. The user will enter a US Dollar amount into a text field and then make a cur
2014-04-26 22:21:42
1198
原创 贝塞尔曲线上一点
计算Bezier曲线上的点,可用Bezier曲线方程,但使用de Casteljau提出的递推算法则要简单得多。 如图3.1.10所示,设P0、P02、P2是一条抛物线上顺序三个不同的点。过P0和P2点的两切线交于P1点,在P02点的切线交P0P1和P2P1于P01和P11,则如下比例成立: 这是所谓抛物线的三切线定理。图3.1.10 抛物线三切线定理当P0
2013-08-16 17:54:36
1056
2
原创 内包含多边形区域填充
#pragma once#include #include #include #include #include #include using namespace std;typedef vector PolygonData;void DrawPolygons( const vector t,SkCanvas* canvas );bool IsPolyInPol
2013-08-16 15:38:58
830
原创 通过一点找最近线段
pair GetPioneerSegment(SkPoint pt,vector> vectorOfSemgents){ pair reValue; reValue.first = SkPoint::Make(0,0); reValue.second = SkPoint::Make(0,0); if (vectorOfSemgents.size() == 0) return reVa
2013-08-13 09:20:58
739
原创 求任意多边形内一点
SkPoint findPointinPolygon(const std::vector& polygon){ if (polygon.size() < 3) return SkPoint::Make(-1,-1); SkPoint p1,p2,p3; //取多边形任意3个点 p1 = polygon[0];p2 = polygon[1];p3 = polygon[2]; /
2013-08-12 17:35:01
1589
原创 绘制贝塞尔曲线通用方法
//计算三次贝塞尔曲线,后面n(n>=3)计算时,都是将点分成一组一组的三次贝塞尔曲线//计算控制点思路来源:http://www.antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATIONSkPoint* CalcThreeBezier(Wm5::Vector2d ptw1,Wm5::Vec
2013-07-26 15:52:36
1236
原创 画贝塞尔曲线
SkPoint* DrawThreeEx(Wm5::Vector2d ptw1,Wm5::Vector2d ptw2,Wm5::Vector2d ptw3, SkCanvas* canvas,SkPaint& paint){ //算出两条边中点,再算出中点连线的中点 SkPoint midOfPtw12,midOfPtw23,mid,midOfmid12mid,midOfmid23mid;
2013-07-26 11:02:01
1282
原创 mfc中视图类加载图片并立即刷新
BOOL CRealView::OnEraseBkgnd(CDC* pDC){ // TODO: 在此添加消息处理程序代码和/或调用默认值 /*if (strpathname.GetLength()==0) { CBitmap bmp; HDC hMemDC=CreateCompatibleDC(pDC->m_hDC); bmp.LoadBitmap(I
2011-10-25 10:12:27
2504
转载 CString转换为int
CString 型转化成 int 型 把 CString 类型的数据转化成整数类型最简单的方法就是使用标准的字符串到整数转换例程。 虽然通常你怀疑使用_atoi()函数是一个好的选择,它也很少会是一个正确的选择。假如你预备使用 Unicode 字符,你应该
2011-10-14 21:46:15
4450
原创 CListView中的OnTimer
一般将Timer放在Frame类中,Doc/view 架构是一个模板,3个类一般只将Timer放在Frame类里, 如果把CListView::OnTimer(nIDEvent);去掉就不会定时监控Timer,执行不会按你设定的时间 执行了不到一秒就可能执行一次OnT
2011-09-26 09:52:23
619
原创 孙鑫VC++视频教程14课源码
<br />TcpSrv.cpp<br />#include <Winsock2.h>#include <stdio.h>void main(){ WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 1, 1 ); err = WSAStartup( wVersionRequested, &wsaData ); if ( err != 0 ) {
2010-12-08 21:53:00
1776
1
原创 创建进程,消息通信,共享内存通信,管道通信
<br />进程A中重要函数<br />void CProcessADlg::OnStartB() //创建进程B{ // TODO: Add your control notification handler code here PROCESS_INFORMATION pi; STARTUPINFO si; //初始化变量 memset(&si,0,sizeof(si)); si.cb=sizeof(si); si.wShowWindow=SW_SHOW; si.dwF
2010-12-04 22:16:00
1111
原创 创建线程,互斥线程,非互斥线程及线程的结束
#include "afxmt.h"//线程函数int data1=0;int data2=0;int data3=0;int data4=0;bool isTermiateThread=false;//结束线程使用CCriticalSection CriticalSection;//使用线程互斥UINT Thread_Add(LPVOID param)//加法线程函数{ isTermiateThread=false; while (++data1) {
2010-12-04 22:07:00
535
原创 ASCII码表完整版
<br />ASCII码表完整版<br />ASCII值<br />控制字符<br />ASCII值<br />控制字符<br />ASCII值<br />控制字符<br />ASCII值<br />控制字符<br />0<br />NUT<br />32<br />(space)<br />64<br />@<br />96<br />、<br />1<br />SOH<br />33<br />!<br />65<br />A<br />97<br />a<br />2<br />STX<br />34
2010-12-01 11:22:00
536
原创 进程之间通过CWnd::SendMessage(WM_COPYDATA,*,*)发送和获取消息
<br />发送端代码:<br />void CProcessADlg::OnSendMessage() { // TODO: Add your control notification handler code here //找到接收消息的窗口(窗口名为Receiver) CString str="ProcessB"; CWnd *pWnd=CWnd::FindWindow(NULL,str); CString m_Msg1; GetDlgItem(IDC_EDIT1)->Ge
2010-11-27 20:19:00
1353
原创 MFC笔记–字符设置问题
int num1,num2,num3;TCHAR ch1[10],ch2[10],ch3[10];GetDlgItem(IDC_EDIT1)->GetWindowTextW(ch1,10);GetDlgItem(IDC_EDIT3)->GetWindowTextW(ch2,10);num1=_ttoi(ch1);num2=_ttoi(ch2);num3=num1+num2;_itot(num3,ch3,10);GetDlgItem(IDC_EDIT4)->SetWindowTextW((LPTSTR)ch3
2010-11-26 19:59:00
365
RSD Lite3.5
2009-02-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人