iOS开发模拟限速

1.模拟器网速调整:

限制时输入下面两行,根据需要修改下面的数字:

sudoipfwpipe1configbw350kbit/splr0.05delay10000ms;

sudoipfwaddpipe1dst-porthttp

不想再去限制网速是,输入下面的命令行:

sudoipfwflush

1.2mac下限制网速:

AdvancedOSXusersknowthatDarwincomeswithipfw,whichcanbeusedtosetupacustomfirewall.Thissameservicehowevercanbeusedtoalsolimitbandwidthonspecificports.

Example:sudoipfwpipe1configbw15KByte/screatesapipethatonlyallowsupto15KB/stogothrough.

Then:sudoipfwadd1pipe1src-port80willattachthatpipetotheoutgoingtrafficonport80,effectivelylimitingtheoutgoingtrafficofthewebserver.sudoipfwdelete1willremovethepipefromtheport.

[kirkmcadds:Ihaven'ttestedthis.Justmakesureyouremembertoturnthisoffwhenyounolongerneedit!]

详情可看:http://nshipster.com/network-link-conditioner/

该工具的Apple官方地址:https://developer.apple.com/downloads/index.action?q=Network%20Link%20Conditioner#

2.子视图超出父视图部分仍然响应点击事件的处理

-(UIView*)hitTest:(CGPoint)pointwithEvent:(UIEvent*)event

{

UIView*view=[superhitTest:pointwithEvent:event];

for(UIView*subviewinself.subviews){

if(view!=nil&&view.userInteractionEnabled)

break;

CGPointnewPoint=[selfconvertPoint:pointtoView:subview];

view=[subviewhitTest:newPointwithEvent:event];

}

returnview;

}

相关推荐