iOS常用技術 微信下標欄

2022-09-20 01:51:08 字數 4689 閱讀 4181

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//89

//螢幕高度

10#define kviewheight [uiscreen mainscreen].bounds.size.height

11//

螢幕寬度

12#define kviewwidth [uiscreen mainscreen].bounds.size.width

13//

rgb顏色

14#define rgba(r,g,b,a) [uicolor colorwithred:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//89

#import

10#import

"header.h"11

12//

typedef enum _sxttabbartype1 sxttabbartype1;

1819

//定義乙個列舉

20typedef ns_options(nsuinteger, sxttabbartype) ;

2627

//定義乙個block

28 typedef void(^sxttabbarblock)(sxttabbartype type);

2930

@class

sxttabbar;

31@protocol sxttabbardelegate 32

33@optional

34 - (void)tabbar:(sxttabbar *)tabbar selectedindex:(sxttabbartype)type;

3536

@end

3738

@inte***ce

sxttabbar : uiview

3940 @property (weak, nonatomic) id

delegate;41

42//

block**方法

43 - (void

)tabbarselectedindexblock:(sxttabbarblock)block;

4445

@end

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//89

#import

"sxttabbar.h"10

#import

"sxtdockitem.h"11

12static nsuinteger ktag = 1000;13

14@inte***ce

sxttabbar ()

1516 @property (strong, nonatomic) sxtdockitem *selectedbtn; //

全域性button

17 @property (strong, nonatomic) nsarray *datalist; //

存放文字和的陣列

1819 @property (copy, nonatomic) sxttabbarblock block; //

block

2021

@end

2223

@implementation

sxttabbar

2425

#pragma mark -

26#pragma mark init methods

27 - (nsarray *)datalist

2833

return

_datalist;34}

3536

#pragma mark -

37#pragma mark lifecycle

38 -(instancetype)initwithframe:(cgrect)frame

3977

78[self addsubview:btn];79}

80}81return

self;82}

8384

//按鈕事件響應方法

85 - (void)buttonaction:(sxtdockitem *)btn

8698

99//

block

100if

(self.block)

103}

104105

//block**

106 - (void

)tabbarselectedindexblock:(sxttabbarblock)block

107110

111@end

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//89

#import

1011

@inte***ce

sxtdockitem : uibutton

1213

@end

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//89

#import

"sxtdockitem.h"10

11static cgfloat kimagescale = 0.64f;12

13@implementation

sxtdockitem

1415

#pragma mark -

16#pragma mark lifecycle

17 -(instancetype)initwithframe:(cgrect)frame

1828

return

self;29}

3031

//調整文字的frame contentrect:button的frame

32 -(cgrect)titlerectforcontentrect:(cgrect)contentrect

3340

41//

42 -(cgrect)imagerectforcontentrect:(cgrect)contentrect

4350

51@end

1//2

04-tabbar4//

5//created by andezhou on 16/1/6.6//

7//8/*

91. 初始化乙個用來顯示button的view

102. 自定義四個按鈕

113. 處理響應事件

12*/

1314

/*15

手機螢幕

164\4s 3.5寸 , }

175\5s\5c 4寸 , }

186\6s 4.7寸 , }

196plus\6splus 5.5寸 , }

204寸\4.7寸\5.5寸 比例都是16:9

21*/

2223

#import

"viewcontroller.h"24

#import

"sxttabbar.h"25

26@inte***ce viewcontroller () 27

28 @property (strong, nonatomic) sxttabbar *backgroundview; //

背景view

29 @property (weak, nonatomic) iboutlet uilabel *textlab;

3031

@end

3233

@implementation

viewcontroller

3435

#pragma mark -

36#pragma mark init methods

37 - (sxttabbar *)backgroundview

38];47}

48return

_backgroundview;49}

5051

#pragma mark -

52#pragma mark sxttabbardelegate

53 - (void)tabbar:(sxttabbar *)tabbar selectedindex:(sxttabbartype)type

5457

58 - (void

)showwithtype:(sxttabbartype)type

5980}81

82#pragma mark -

83#pragma mark lifecycle

8485 - (void

)viewdidload

8692

93 - (void

)bounds

94103

104 - (void

)didreceivememorywarning

108109

@end

IOS微信分享

ios開發工具包,解壓後得到 libwechatsdk.a wxapi.h wxapiobject.h 三個檔案。將這3個檔案拖到你的工程裡。然後 選擇你的工程設定項,選中 targets 一欄,在 info 標籤欄的 url type 新增 url scheme 為你所註冊的應用程式id。如圖然後...

ios 微信 支付

2 將sdk檔案中包含的 libwechatsdk.a,wxapi.h,wxapiobject.h 三個檔案新增到你所建的工程中 3 匯入對應的庫檔案 systemconfiguration.framework,libz.dylib,libsqlite3.0.dylib,libc dylib。imp...

iOS 微信支付

當然如果是在xcode7及以上版本,還需要進行下列配置,不然會編譯不通過 解析服務端返回json資料 nserror error 載入乙個nsurl物件 nsurlrequest request nsurlrequest requestwithurl nsurl urlwithstring str ...