我正在使用 https://github.com/sberrevoets/SDCAlertView ,它支持对 #imported libraries
train = ImageDataGenerator(rescale=1/255)
test = ImageDataGenerator(rescale=1/255)
train_dataset = train.flow_from_directory(r'C:\Users\mishr\OneDrive\Desktop\jj',
target_size=(150,150),
batch_size = 32, class_mode='categorical')
test_dataset = test.flow_from_directory(r"C:\Users\mishr\Downloads\SoML_Hackathon\SoML-50\test_data",
target_size=(150,150),
batch_size =32, class_mode='categorical')
model = Sequential([
Conv2D(16, (3, 3), activation='relu', input_shape=(150, 150, 3)), MaxPooling2D(2, 2),
Conv2D(32, (3, 3), activation='relu'), MaxPooling2D(2, 2),
Conv2D(64, (3, 3), activation='relu'),
Conv2D(64, (3, 3), activation='relu'),
MaxPooling2D(2, 2),
Flatten(),
Dense(512, activation='relu'),
#Dense(512, activation='relu'),
Dense(3, activation='softmax')
])
model.summary()
model.compile(optimizer='adam',loss='categorical_crossentropy',metrics=['accuracy'])
model.fit_generator(train_dataset,
steps_per_epoch = 250,
epochs = 10,
validation_data = test_dataset
)
def predictImage(filename):
img1 = image.load_img(filename,target_size=(150,150))
plt.imshow(img1)
Y = image.img_to_array(img1)
X = np.expand_dims(Y,axis=0)
val = model.predict(X)
print(val)
喜欢的演示文稿的自定义视图。
UIAlertController
是一个 PresetColorView
。它包含一个 UIView
UICollectionView
被添加为 PresetColorView
alertAlertController.contentView
alertAlertController.contentView.heightAnchor.constraint
块内对 alertAlertController.view.layoutIfNeeded()
执行调用。请注意,UIView.animate
是 alertAlertController.view
的父视图。动画代码看起来很简单
alertAlertController.contentView
正如您在动画中看到的,这也会导致 private func animateHeight(_ pageIndex: Int) {
guard let heightConstraint = self.heightConstraint else { return }
guard let alertAlertController = self.alertAlertController else { return }
let contentView = alertAlertController.contentView
let height = getHeight(pageIndex, contentView)
alertAlertController.view.layoutIfNeeded()
// height constraint for alertAlertController.contentView
heightConstraint.constant = height
UIView.animate(withDuration: 2) {
//
// Not alertAlertController.contentView.layoutIfNeeded()
// We need to perform layoutIfNeeded on parent view.
//
alertAlertController.view.layoutIfNeeded()
}
}
上的“淡入”/“淡出”动画。
我可以知道为什么会这样吗?
我已经尝试过 Prevent unwanted animations on subviews when animating constraints 的建议,但没有用。这是我做过的两件事
UICollectionView
中使用UIView.performWithoutAnimation
layoutSubviews
中使用UIView.performWithoutAnimation
我可以知道为什么 contentView 的动画高度约束会导致其子视图的其他不需要的动画吗?
cellForItemAt