make a cocoapods lib

—2015.08.02—

error- ERROR | [watchOS] Returned an unsuccessful exit code. blabla

add flowing code in podspec

1
2
3
s.osx.deployment_target = '10.8'
s.ios.deployment_target = '6.0'
s.watchos.deployment_target = '2.0'

build on Xcode 7

—2014.11.05—

update lib

edit the NSString-BlockHelper.podspec add 1.0.1 version

1
2
git tag 1.0.1; git push --tags
pod trunk push NSString-BlockHelper.podspec --verbose

get error You need to register a session first.

1
2
3
pod trunk register <yourEmail> '<yourName>' --description='macbook pro'
#click the confirm email in yourEmail
pod trunk push NSString-BlockHelper.podspec --verbose

pod search cannot search the 1.0.1 version

but pod install in new project can install 1.0.1

—2014.08.29—

nshipster blog

http://guides.cocoapods.org/

Your First CocoaPod

demo : link

  1. create NSString-BlockHelper.podspec
1
2
3
4
5
6
7
8
9
10
11
Pod::Spec.new do |s|
s.name = 'NSString-BlockHelper'
s.version = '1.0.0'
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.summary = "NSString+BlockHelper"
s.homepage = 'https://github.com/bumaociyuan/NSString-BlockHelper'
s.authors = { 'bumaociyuan' => 'http://bumaociyuan.github.io/' }
s.source = { :git => 'https://github.com/bumaociyuan/NSString-BlockHelper.git', :tag => s.version.to_s }
s.source_files = 'NSString+BlockHelper/*{h,m}'
s.requires_arc = true
end
  1. set the tag
    git tag 1.0.0; git push --tags
  1. use the cmd
    pod trunk push NSString-BlockHelper.podspec --verbose to push .podspec to repo

Enable php on mac

link

  1. Navigate to /etc/apache2
  2. Do a search for “php”. You should see the following line:#LoadModule php5_module libexec/apache2/libphp5.soRemove the “#”
  3. Save the file. You may need to authenticate upon saving.
  4. run sudo apachectl restart to restart apache
  5. visit localhost you will see It works!
  6. /etc/apache2/httpd.confSearch for “virtual” in your text editor. You should see the following lines:
1
2
#Virtual hosts
#Include /private/etc/apache2/ extra/httpd-

Uncomment the second line that starts with “#Include” by removing the “#”. We now need to modify httpd-vhosts.conf file to add our virtual hosts.

  1. open/etc/apache2/extra/httpd-vhosts.conf
1
2
DocumentRoot "/Users/username/Sites/Website"
ServerName yourwebsitename

Another tutorial

  • Install : XAMPP Mac OS X 1.7.3 download
  • sudo su
  • /Applications/XAMPP/xamppfiles/xampp start

if you see

1
2
XAMPP: Starting ProFTPD.../Applications/XAMPP/xamppfiles/xampp: line 184: /Applications/XAMPP/xamppfiles//var/proftpd/start.err: No such file or directory fail.
Contents of "/Applications/XAMPP/xamppfiles//var/proftpd/start.err": cat: /Applications/XAMPP/xamppfiles//var/proftpd/start.err: No such file or directory

do these commands

1
2
3
4
5
6
7
`sudo mkdir /Applications/XAMPP/xamppfiles/var/proftpd/`
`touch /Applications/XAMPP/xamppfiles/var/proftpd/start.err`
`sudo /Applications/XAMPP/xamppfiles/xampp fix_rights`
then redo the `/Applications/XAMPP/xamppfiles/xampp start` cmd

AFNetworking issues

error :

Request failed: unacceptable content-type: text/html

or

The operation couldn’t be completed (Cocoa error 3840 )

fix this issue

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager new];
NSMutableSet *set = manager.responseSerializer.acceptableContentTypes.mutableCopy;
[set addObject:@"text/html"];
   manager.responseSerializer.acceptableContentTypes = set;

baidu map issues

关于百度地图IOS API 2.3.0 不显示地图的解决方法。

在AppDelegate里面init BMapManager以后。
设为属性
不然会出各种问题

navigation bar customize back button

July 21, 2015
iOS开发的一些奇巧淫技

1
2
3
4
5
6
7
8
9
10
11
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
initWithImage:img
style:UIBarButtonItemStylePlain
target:self
action:@selector(onBack:)];
self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;

December 27, 2014 update
link

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                   forBarMetrics:UIBarMetricsDefault];

in AppDelegate.m

UINavigationBar * bar = [UINavigationBar appearance];
bar.backIndicatorImage = [UIImage imageNamed:@"navBackButton"];
bar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"navBackButton"];

in BaseViewController.m -viewdidload

self.navigationItem.leftItemsSupplementBackButton = YES;
self.navigationItem.backBarButtonItem = [self textBarButtonItemWithText:@""];

cannot handle the back bar button item click event

group style tableview background color in ios 7

#get color with

1
UIColor *result = self.tableView.backgroundColor;

#group style tableview background color in ios 7

1
2
[UIColor colorWithRed:0.933 green:0.933 blue:0.957 alpha:1.000]
//hex : EDEDF4

#ios 8

1
2
[UIColor colorWithRed:0.937255 green:0.937255 blue:0.956863 alpha:1.000]
//hex: EFEFF4

hide static tableview section

主要是实现以下几个方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if(section == 1 && hideTableSection)
return [[UIView alloc] initWithFrame:CGRectZero];
return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if(section == 1 && hideTableSection)
return 1;
return 32;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if(section == 1 && hideTableSection)
return 1;
return 16;
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
if(section == 1 && hideTableSection)
return [[UIView alloc] initWithFrame:CGRectZero];
return nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(section == 1)
{
if(hideTableSection)
return 0;
else
return 1;
}
else
{
return 2;
}
}