This is regarding the keyboardFrameWillChange notification.
This code worked as expected under Xcode 14.1
With floating_Keyboard = false
Tap the textView
Full keyboard opens
textView moves up to avoid the keyboard
Change to floating keyboard
Floating keyboard opens
textView moves to home position
Tap the view background to close the keyboard
Tap the textView again
Floating keyboard opens
txtView remains at home position
Change to full keyboard
Full keyboard opens
textView moves up to avoid the keyboard
With Xcode 14.2 if the keyboard is floating and the textView is firstResponder, and the keyboard is then set back to full keyboard, the floating_Keyboard = false part of the code does not fire. This means the textView remains in the home position even though the full keyboard opens.
Is anybody else experiencing this?
private var floating_Keyboard: Bool = false
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardFrameWillChange), name: NSNotification.Name(rawValue: UIResponder.keyboardWillChangeFrameNotification.rawValue), object: nil)
@objc func keyboardFrameWillChange(notification: NSNotification)
{
let userInfo = notification.userInfo!
let keyBoardBeginRect = userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! CGRect
let screenBounds = UIScreen.main.bounds
if (keyBoardBeginRect.equalTo(CGRect.zero))
{
print("\(#function) Floating keyboard")
floating_Keyboard = true
if trickPatterFld.isFirstResponder
{
UIView.animate(withDuration: 0.3) { [weak self] in
self?.bottom_Constraint.constant = self!.patter_Bottom_Constraint
self?.view.layoutIfNeeded()
}
}
} else if keyBoardBeginRect.width == screenBounds.width {
print("\(#function) Full keyboard")
floating_Keyboard = false
if trickPatterFld.isFirstResponder
{
UIView.animate(withDuration: 0.3) { [weak self] in
self?.bottom_Constraint.constant = self!.keyboardHeight
self?.view.layoutIfNeeded()
}
}
}
}
func textViewDidBeginEditing(_ textView: UITextView)
{
if textView.tag == 2
{
set_The_Keyboard_Hgt()
if textView.textColor == Theme.current.placeHolderTextColor
{
textView.text = ""
textView.textColor = Theme.current.textColor
}
if floating_Keyboard == false
{
UIView.animate(withDuration: 0.3) { [weak self] in
self?.bottom_Constraint.constant = self!.keyboardHeight
self?.view.layoutIfNeeded()
}
}
} else {
if textView.textColor == Theme.current.placeHolderTextColor
{
textView.text = ""
textView.textColor = Theme.current.textColor
}
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
In a collection view I want that when a cell is tapped to have the background color changed to indicate highlighting. When that same cell is tapped again, turn the highlighting off. When another cell is tapped, un-highlight the previously highlighted cell and highlight the new one.
I pretty much have that working but it's all done manually in code. If there's a better way using delegate methods or something, please enlighten me.
The collection view is in a pop-up view. My problem is that when the pop-up view is closed and then reopened, the last selected cell is still highlighted.
I tried this, but no-joy.
choose_CollectionView_Outlet.indexPathsForSelectedItems?.forEach { choose_CollectionView_Outlet.deselectItem(at: $0, animated: false) }
I think it's because I am manually setting the background color to indicate highlight. If anybody has a solution for this, please share it.
extension Choose_Items_VC: UICollectionViewDelegate
{
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
{
if collectionView == collectionView_Outlet
{
// Filter Selection
let item = itemArray[indexPath.row].Item_Name
if let cell = collectionView.cellForItem(at: indexPath)
{
cell.backgroundColor = .lightGray
}
switch itemPicked
{
case K.AppFacing.type:
if item == type_Fld_Outlet.text
{
pickerDoneBtn_Outlet.isEnabled = false
pickerFld_Outlet.text = ""
newType_ID = 0
} else {
pickerFld_Outlet.text = item
newType_ID = itemArray[indexPath.row].ItemID
pickerDoneBtn_Outlet.isEnabled = true
}
case K.AppFacing.style:
if item == style_Fld_Outlet.text
{
pickerDoneBtn_Outlet.isEnabled = false
pickerFld_Outlet.text = ""
newType_ID = 0
} else {
pickerFld_Outlet.text = item
newType_ID = itemArray[indexPath.row].ItemID
pickerDoneBtn_Outlet.isEnabled = true
}
case K.AppFacing.venue:
if item == venue_Fld_Outlet.text
{
pickerDoneBtn_Outlet.isEnabled = false
pickerFld_Outlet.text = ""
newType_ID = 0
} else {
pickerFld_Outlet.text = item
newType_ID = itemArray[indexPath.row].ItemID
pickerDoneBtn_Outlet.isEnabled = true
}
default: break
}
} else if collectionView == choose_CollectionView_Outlet {
let cell = collectionView.cellForItem(at: indexPath)
if cell?.backgroundColor == .lightGray
{
cell?.backgroundColor = nil
// cell?.isSelected = false
// cell?.isHighlighted = false
add_Btn_Outlet.isEnabled = false
gItem_ID = 0
} else {
cell?.backgroundColor = .lightGray
// cell?.isSelected = true
// cell?.isHighlighted = true
gItem_ID = choose_Items_Array[indexPath.item].ItemID
add_Btn_Outlet.isEnabled = true
}
}
}
func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath)
{
if let cell = collectionView.cellForItem(at: indexPath)
{
if collectionView == collectionView_Outlet
{
cell.backgroundColor = .lightGray
}
}
}
func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath)
{
if let cell = collectionView.cellForItem(at: indexPath)
{
if collectionView == collectionView_Outlet
{
cell.backgroundColor = nil
}
}
}
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath)
{
if let cell = collectionView.cellForItem(at: indexPath)
{
cell.backgroundColor = nil
}
}
}
I had an ugly glitch when I was committing one of my Xcode projects to BitBucket. I thought it was just a wifi connection issue but there's something else going on. I've tried to commit several other projects and they are all exhibiting the same problem. I have attached a screen-shot of the window that opens when doing a commit. There are files that have been changed but they do not show in the commit window. I don't see any Xcode settings that were changed. I have deleted and reinstalled Xcode and it didn't change anything. Has anybody experienced this?
I'm working on some older apps, and I don't think they were ever opened in Xcode 14. I'm updating them in Xcode 15 and I'm having some problems with the Plist. It looks like I've lost the link between the Info.plist and their related Build Settings. I want to lock the iPhone orientation to portrait. This always worked in the past.
When I change the Deployment Info, iPad Orientations or iPhone Orientations using the checkboxes the updates show up in the Info Custom iOS Target Properties (info.plist). However, they are not reflected in the Info.plist Values in the build settings. Even if I update the build settings manually, I still don't have the iPhone locked in portrait orientation.
Has anybody run into this and know how to fix it?
Thanks for the help in advance.
On Jan 2, 2024 I uploaded and got released 13 new apps. The problem I'm having is that only one of the new apps is showing data in analytics, the other 12 show nothing. They are all very similar apps with pretty much the same search criteria as the rest of my apps, 42 total. All of the other apps show plenty of analytic data.
I've done searches and the apps do show up in the search.
Is there a limit on the number of apps you can have?
Is there a way to have Apple look and see if I've done something wrong that's causing the problem?
Thank in advance
My apps are set up to store data in a SQLite database on the device. The user is also able to add images and those are also stored on the device. The database and images are stored in the apps documents folder. The database is set up with four tables, one of them containing a list of selectable items so the information in that table is constant. The other three are read/write to the user. The database also contains a field, which contains true/false as to whether the app has been purchased or not.
My thought behind was that this would make the users data private and secure.
My apps are set up using UIKit so SwiftData is not an option unless I rewrite the entire app in SwiftUI. Or is there a good way to use SwiftData in UIKit?
Is there a way to store/move this information into the cloud so that the data can be synced across multiple devices?
Or maybe set up an import/export scenario using a CSV file for the database using Dropbox?
Any help or advice would be appreciated.
Thanks in advance.