We are developing with objective-c.
I am trying to operate a project created about 6 years ago and operated until about 4 years ago with the version of Xcode 12.5 again. There is a place to process by touching the thumbnail image,
・ On iPhone 5 devices with iOS 10.3.4, a notification will be sent to touches Ended.
・ Notification does not come to touchesEnded on iPad (7th generation) of iOS 14.8.1.
・ Notification does not come to touchesEnded on the emulator of iPhone12.
The behavior is different like. Thumbnail image
- (void)setupLayer
{
imageLayer_ = [[UIImageView alloc]initWithFrame:self.bounds];
imageLayer_.frame = self.bounds;
videoLayer_ = [[UIImageView alloc]initWithFrame:self.bounds];
videoLayer_.frame = self.bounds;
duration_ = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 15)];
duration_.backgroundColor = [UIColor clearColor];
duration_.frame = CGRectMake(30, 60, 40, 15);
[self addSubview:imageLayer_];
[self addSubview:videoLayer_];
[self addSubview:duration_];
}
- (void)setSelected:(BOOL)selected
{
thumbnail_.selected = selected;
//self.btImageView.userInteractionEnabled = YES;
if (selected) {
if (selectedCover_ == nil) {
selectedCover_ = [[ThumbnailViewCellSelectedCover alloc]initWithFrame:self.bounds];
selectedCover_.backgroundColor = [UIColor clearColor];
}
[self addSubview:selectedCover_];
} else {
[selectedCover_ removeFromSuperview];
}
}
- (id)init
{
self = [super initWithFrame:CGRectMake(0, 0, 75, 75)];
if (self) {
[self setupLayer];
}
return self;
}
- (void)dealloc
{
SAFE_RELEASE(imageLayer_);
SAFE_RELEASE(videoLayer_);
SAFE_RELEASE(duration_);
[thumbnail_ release];
[selectedCover_ release];
[super dealloc];
}
- (void)setThumbnail:(Thumbnail *)thumbnail
{
isSetup = YES;
SAFE_RELEASE(thumbnail_);
thumbnail_ = [thumbnail retain];
NSString *imageName = [PBApplicationDirectoryManager getFullFilePathWithFilePath:thumbnail.photo.thumbnail];
[self setSelected:thumbnail.selected];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!isSetup) {
return;
}
NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
[params setValue:[NSString stringWithFormat:@"%ld", (long)thumbnail_.index] forKey:@"index"];
[params setValue:[NSString stringWithFormat:@"%@", ((thumbnail_.selected == YES)?@"YES":@"NO")] forKey:@"selected"];
[params setValue:self forKey:@"thumbnailView"];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
NSNotification *notification = [NSNotification notificationWithName:ThumbnailTouchEvent object:self userInfo:params];
[center postNotification:notification];
[params release];
}
I am creating it with a code like this. Since it works on the iPhone 5 terminal of iOS 10.3.4, I think that it is not a code problem but a setting due to the difference in OS version is necessary. What should i add
I look forward to working with you.