Trying to add UIButton on top of vrf-reader ContentView

176 Views Asked by At

I am trying to insert some buttons in the PDF page rendered by the open source iOs reader vfr-reader https://github.com/vfr/Reader

Basically this is the code I am trying to implement in the initWithFrame method of ReaderContentView:

if (theContentView != nil) // Must have a valid and initialized content view {

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [myButton setFrame:CGRectMake(269, 262, 100, 100)];
        [myButton addTarget:self action:@selector(links) forControlEvents:UIControlEventTouchUpInside];
        [myButton setTitle:@"asdasd" forState:UIControlStateNormal];
        [theContentView addSubview:myButton];

The button doesn't work, and I can see that it is rendered and flattened in some way so it doesn't seem to be a button anymore as you can see here at full zoom.

uibutton seems to be blurry However running DCInspector, despite warning that

2013-05-24 12:27:34.560 Reader[45333:c07] DCIntrospect: *** WARNING: One or more values of this view's frame are non-integer values. This view will likely look blurry. ***

seems to identify the button properly when inspected.

To test this case, just download the reader project and put my code in ReaderContentView at line 113. I am pretty sure I am doing something totally wrong. Thank you for help!

1

There are 1 best solutions below

0
On

it was a bit tricky but I discovered that userInteractionEnabled was not set properly on the container view. I should have supposed that :)