常规注释引脚的原点位于底部中间,因此引脚始终指向同一位置.
但是当我添加自定义图像时,它的原点是图像的中心,所以每次放大或缩小,我的图像底部指向不同的位置.

在这里我的别针应该指向巴黎的中心但是

但是当我放大时,我的图钉的底部并没有指向巴黎的中心.
我正在尝试CGRect.origin但没有得到任何有用的东西.
这是我的代码:
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView * customPinView = [[MKAnnotationView alloc] init];
UIImage * img = [UIImage imageNamed:@"waterPin.png"] ;
CGRect resizeRect;
resizeRect.size.height = 40;
resizeRect.size.width = 40;
resizeRect.origin = (CGPoint){0.0f, 0.0f};
UIGraphicsBeginImageContext(resizeRect.size);
[img drawInRect:resizeRect];
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
customPinView.image = resizedImage;
return customPinView;
}
Run Code Online (Sandbox Code Playgroud) 拥有一个包含Select Ant 组件的组件 MyComp并愿意测试 MyComp 以确保处理程序正确并被调用
class MyComp extends Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(value) {
this.props.doSomething();
}
render() {
return (
<Select onChange={this.props.handleChange}>
<Option value={"Op0"} >Opt0</Option>
<Option value={"Op1"} >Opt1</Option>
<Option value={"Op2"} >Opt2</Option>
</Select>
)
}
}
Run Code Online (Sandbox Code Playgroud)
我希望能够按如下方式对其进行测试:
it('calls the right callback', () => {
const Option = Select.Option;
const mockHandler = jest.fn();
const wrapper = mount(<MyComp handleChange ={mockHandler}/>);
let select = wrapper.find(Select);
select.simulate("onChange"); // also tried 'change'
expect(mockHandler).toHaveBeenCalled()
});
Run Code Online (Sandbox Code Playgroud)
请记住它是“mount”而不是浅的,所以它实际上渲染了子组件
我想在AVMutableComposition中添加AVMediaTypeSubtitle类型的轨道,添加本身很容易,但如何填充此轨道?以及如何阅读?!!
我找不到任何与如何读/写AVMediaTypeSubtitle类型的轨道相关的东西!
埃及没有更多的夏令时,我正在服务器上制作一个网络应用程序,并试图将时间更改为埃及时间,它工作,但在夏令时模式下,我该如何停用它!
antd ×1
avfoundation ×1
cocoa ×1
date ×1
dst ×1
enzyme ×1
ios ×1
java ×1
jestjs ×1
mapkit ×1
objective-c ×1
reactjs ×1
servlets ×1
subtitle ×1
unit-testing ×1
web-services ×1