Skip to content

Commit

Permalink
fix ipad?
Browse files Browse the repository at this point in the history
  • Loading branch information
cranci1 committed Jun 20, 2024
1 parent bf40e7e commit 0aa7e72
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
Binary file not shown.
16 changes: 9 additions & 7 deletions AnimeGen/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="gray" title="pic.re" cornerStyle="medium">
<backgroundConfiguration key="background"/>
<backgroundConfiguration key="background">
<color key="strokeColor" systemColor="systemGray4Color"/>
</backgroundConfiguration>
<color key="baseForegroundColor" systemColor="labelColor"/>
<color key="baseBackgroundColor" systemColor="systemGray4Color"/>
</buttonConfiguration>
Expand Down Expand Up @@ -1940,7 +1942,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="731.66666603088379" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="mst-hn-gIg" id="d1t-mQ-sS1">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="NekoBot" translatesAutoresizingMaskIntoConstraints="NO" id="BaJ-S5-7fN">
Expand Down Expand Up @@ -1977,7 +1979,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="831.66666603088379" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="IWp-Nx-xkf" id="UTM-ox-K0H">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Hmtai" translatesAutoresizingMaskIntoConstraints="NO" id="Y7X-uZ-you">
Expand Down Expand Up @@ -2014,7 +2016,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="931.66666603088379" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="BXZ-Sy-Reg" id="LRd-OU-HE2">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="kyoko" translatesAutoresizingMaskIntoConstraints="NO" id="dW7-4Q-Rbf">
Expand Down Expand Up @@ -2051,7 +2053,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="1031.6666660308838" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Idh-qs-KGR" id="nSd-i1-IEG">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Purr" translatesAutoresizingMaskIntoConstraints="NO" id="j08-uO-HJI">
Expand Down Expand Up @@ -2088,7 +2090,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="1131.6666660308838" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="poB-13-Rb5" id="4EK-hi-GOt">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="n-sfw" translatesAutoresizingMaskIntoConstraints="NO" id="eoh-Fh-BgG">
Expand Down Expand Up @@ -2125,7 +2127,7 @@ Also Thanks to all the active users of the TestFlight beta which are always help
<rect key="frame" x="16" y="1231.6666660308838" width="343" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="8Df-kZ-A25" id="utp-SG-59Z">
<rect key="frame" x="0.0" y="0.0" width="326.33333333333331" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="324.66666666666669" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="nekos.life" translatesAutoresizingMaskIntoConstraints="NO" id="buh-5h-Juf">
Expand Down
21 changes: 18 additions & 3 deletions AnimeGen/Settings/AppPref.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,30 @@ class AppPref: UITableViewController {

@IBAction func presentActionSheet(_ sender: UIButton) {
isPresentingActionSheet = true
presentChoicesActionSheet()
presentChoicesActionSheet(from: sender)
}

func presentChoicesActionSheet() {
func presentChoicesActionSheet(from sender: UIButton) {
let actionSheet = UIAlertController(title: "Choose Default API", message: nil, preferredStyle: .actionSheet)

for (index, choice) in choices.enumerated() {
let action = UIAlertAction(title: choice, style: .default, handler: { _ in
self.updateSelectedChoiceIndex(index)
})
if let icon = UIImage(named: choiceIcons[index]) {
let resizedIcon = icon.resized(to: CGSize(width: 35, height: 35))
let resizedIcon = icon.resizedImage(to: CGSize(width: 35, height: 35))
action.setValue(resizedIcon.withRenderingMode(.alwaysOriginal), forKey: "image")
}
actionSheet.addAction(action)
}

actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))

if let popoverController = actionSheet.popoverPresentationController {
popoverController.sourceView = sender
popoverController.sourceRect = sender.bounds
}

present(actionSheet, animated: true, completion: nil)
}

Expand All @@ -82,3 +87,13 @@ class AppPref: UITableViewController {
APIDefa.setTitle(selectedChoice, for: .normal)
}
}

extension UIImage {
func resizedImage(to size: CGSize) -> UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
draw(in: CGRect(origin: .zero, size: size))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage ?? self
}
}

0 comments on commit 0aa7e72

Please sign in to comment.